chromium/chrome/browser/task_manager/providers/worker_task_provider_browsertest.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <memory>
#include <vector>

#include "base/command_line.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_test_util.h"
#include "chrome/browser/profiles/profile_window.h"
#include "chrome/browser/task_manager/providers/task_provider_observer.h"
#include "chrome/browser/task_manager/providers/worker_task_provider.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/service_worker_context.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "net/dns/mock_host_resolver.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/origin.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_switches.h"
#endif

namespace task_manager {

namespace {

std::u16string ExpectedTaskTitle(const std::string& title) {}

// Get the process id of the active WebContents for the passed |browser|.
int GetChildProcessID(Browser* browser) {}

}  // namespace

class WorkerTaskProviderBrowserTest : public InProcessBrowserTest,
                                      public TaskProviderObserver {};

// Make sure that the WorkerTaskProvider can create/delete a WorkerTask of type
// SERVICE_WORKER based on the actual service worker status, and the task
// representing the service worker has the expected properties.
IN_PROC_BROWSER_TEST_F(WorkerTaskProviderBrowserTest,
                       CreateServiceWorkerTasksForSingleProfile) {}

// If the profile is off the record, the WorkerTaskProvider can still grab the
// correct information and create/delete the task.
IN_PROC_BROWSER_TEST_F(WorkerTaskProviderBrowserTest,
                       CreateServiceWorkerTasksForOffTheRecordProfile) {}

// If the profile are created dynamically and there is more than one profile
// simultaneously, the WorkerTaskProvider can still works.
// Flaky on all platforms. https://crrev.com/1244009.
IN_PROC_BROWSER_TEST_F(WorkerTaskProviderBrowserTest,
                       DISABLED_CreateTasksForMultiProfiles) {}

IN_PROC_BROWSER_TEST_F(WorkerTaskProviderBrowserTest, CreateExistingTasks) {}

// Tests that destroying a profile while updating will correctly remove the
// existing tasks. An incognito browser is used because a regular profile is
// never truly destroyed until browser shutdown (See https://crbug.com/88586).
// TODO(crbug.com/40743320): Fix the flakiness and re-enable this.
IN_PROC_BROWSER_TEST_F(WorkerTaskProviderBrowserTest,
                       DISABLED_DestroyedProfile) {}

}  // namespace task_manager