#include <stddef.h>
#include "apps/test/app_window_waiter.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/pattern.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/apps/platform_apps/app_browsertest_util.h"
#include "chrome/browser/devtools/devtools_window_testing.h"
#include "chrome/browser/extensions/api/tabs/tabs_api.h"
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/test/browser_test.h"
#include "extensions/browser/api_test_utils.h"
#include "extensions/common/extension_builder.h"
#include "extensions/test/result_catcher.h"
#include "extensions/test/test_extension_dir.h"
#include "ui/base/ozone_buildflags.h"
#include "ui/views/test/widget_test.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_observer.h"
namespace extensions {
keys;
utils;
ContextType;
ExtensionTabsTest;
IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetLastFocusedWindow) { … }
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_QueryLastFocusedWindowTabs …
#else
#define MAYBE_QueryLastFocusedWindowTabs …
#endif
IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, MAYBE_QueryLastFocusedWindowTabs) { … }
class NonPersistentExtensionTabsTest
: public ExtensionApiTest,
public testing::WithParamInterface<ContextType> { … };
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_TabCurrentWindow …
#elif BUILDFLAG(IS_LINUX)
#define MAYBE_TabCurrentWindow …
#else
#define MAYBE_TabCurrentWindow …
#endif
IN_PROC_BROWSER_TEST_P(NonPersistentExtensionTabsTest, MAYBE_TabCurrentWindow) { … }
#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_OZONE)
#define MAYBE_TabGetLastFocusedWindow …
#else
#define MAYBE_TabGetLastFocusedWindow …
#endif
IN_PROC_BROWSER_TEST_P(NonPersistentExtensionTabsTest,
MAYBE_TabGetLastFocusedWindow) { … }
#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)
IN_PROC_BROWSER_TEST_P(NonPersistentExtensionTabsTest, WindowSetFocus) {
ASSERT_TRUE(RunExtensionTest("window_update/set_focus")) << message_;
}
#endif
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
#if !BUILDFLAG(IS_MAC)
class ExtensionWindowLastFocusedTest : public PlatformAppBrowserTest { … };
void ExtensionWindowLastFocusedTest::SetUpOnMainThread() { … }
void ExtensionWindowLastFocusedTest::ActivateBrowserWindow(Browser* browser) { … }
Browser* ExtensionWindowLastFocusedTest::CreateBrowserWithEmptyTab(
bool as_popup) { … }
int ExtensionWindowLastFocusedTest::GetTabId(
const base::Value::Dict& dict) const { … }
std::optional<base::Value> ExtensionWindowLastFocusedTest::RunFunction(
ExtensionFunction* function,
const std::string& params) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWindowLastFocusedTest,
NoDevtoolsAndAppWindows) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWindowLastFocusedTest,
NoTabIdForDevToolsAndAppWindows) { … }
#endif
TabsApiInteractiveTest;
IN_PROC_BROWSER_TEST_F(TabsApiInteractiveTest,
OpeningAnUnfocusedWindowDoesntCoverTheFocusedWindow) { … }
}