[Extensions] Convert (most of) apps test message listener uses
Update most uses of ExtensionTestMessageListener in //apps and //chrome/browser/apps to the new constructors with an enum for ReplyBehavior. Omit the behavior when it's unnecessary (when the caller does not want to send a custom reply). This CL should have no behavior change. Bug: 1324791 Change-Id: I0cb8e2c6b02ee2f1c8eaeb674d4bea5e2c530066 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3662182 Commit-Queue: Trent Apted <tapted@chromium.org> Auto-Submit: Devlin Cronin <rdevlin.cronin@chromium.org> Reviewed-by: Trent Apted <tapted@chromium.org> Cr-Commit-Position: refs/heads/main@{#1006693}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
c6af7dbd9c
commit
9f73eb37d4
apps
chrome/browser/apps
app_service
guest_view
platform_apps
api
arc_apps_private
media_galleries
sync_file_system
@ -51,7 +51,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, RunningAppsAreRecorded) {
|
||||
// Pretend that the app is supposed to be running.
|
||||
extension_prefs->SetExtensionRunning(extension->id(), true);
|
||||
|
||||
ExtensionTestMessageListener restart_listener("onRestarted", false);
|
||||
ExtensionTestMessageListener restart_listener("onRestarted");
|
||||
apps::AppRestoreServiceFactory::GetForBrowserContext(browser()->profile())
|
||||
->HandleStartup(true);
|
||||
EXPECT_TRUE(restart_listener.WaitUntilSatisfied());
|
||||
@ -60,7 +60,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, RunningAppsAreRecorded) {
|
||||
// Tests that apps are recorded in the preferences as active when and only when
|
||||
// they have visible windows.
|
||||
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ActiveAppsAreRecorded) {
|
||||
ExtensionTestMessageListener ready_listener("ready", true);
|
||||
ExtensionTestMessageListener ready_listener("ready",
|
||||
ReplyBehavior::kWillReply);
|
||||
const Extension* extension =
|
||||
LoadExtension(test_data_dir_.AppendASCII("platform_apps/active_test"));
|
||||
ASSERT_TRUE(extension);
|
||||
@ -163,8 +164,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_FileAccessIsRestored) {
|
||||
"temp", temp_directory.GetPath());
|
||||
|
||||
extensions::ExtensionHostTestHelper host_helper(profile());
|
||||
ExtensionTestMessageListener access_ok_listener(
|
||||
"restartedFileAccessOK", false);
|
||||
ExtensionTestMessageListener access_ok_listener("restartedFileAccessOK");
|
||||
const Extension* extension =
|
||||
LoadAndLaunchPlatformApp("file_access_restored_test", "fileWritten");
|
||||
ASSERT_TRUE(extension);
|
||||
|
@ -59,7 +59,7 @@ const char* kSwitchesToCopy[] = {
|
||||
// Case where Chrome is already running.
|
||||
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
|
||||
MAYBE_LoadAndLaunchAppChromeRunning) {
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
|
||||
const base::CommandLine& cmdline = *base::CommandLine::ForCurrentProcess();
|
||||
base::CommandLine new_cmdline(cmdline.GetProgram());
|
||||
@ -95,7 +95,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
|
||||
MAYBE_LoadAndLaunchAppWithFile) {
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
|
||||
const base::CommandLine& cmdline = *base::CommandLine::ForCurrentProcess();
|
||||
base::CommandLine new_cmdline(cmdline.GetProgram());
|
||||
@ -149,7 +149,7 @@ class LoadAndLaunchPlatformAppBrowserTest : public PlatformAppBrowserTest {
|
||||
}
|
||||
|
||||
void LoadAndLaunchApp() {
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
|
||||
|
||||
// Start an actual browser because we can't shut down with just an app
|
||||
|
@ -166,7 +166,8 @@ class AppNotificationsExtensionApiTest : public extensions::ExtensionApiTest {
|
||||
const extensions::Extension* extension = LoadExtension(extdir);
|
||||
EXPECT_TRUE(extension);
|
||||
|
||||
ExtensionTestMessageListener launched_listener("launched", true);
|
||||
ExtensionTestMessageListener launched_listener("launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
apps::AppServiceProxyFactory::GetForProfile(profile())->Launch(
|
||||
extension->id(), ui::EF_SHIFT_DOWN,
|
||||
apps::mojom::LaunchSource::kFromTest);
|
||||
@ -207,7 +208,7 @@ IN_PROC_BROWSER_TEST_F(AppNotificationsExtensionApiTest,
|
||||
ASSERT_FALSE(HasBadge(profile(), extension1->id()).value());
|
||||
|
||||
// Load the basic app to generate a notification.
|
||||
ExtensionTestMessageListener notification_created_listener("created", false);
|
||||
ExtensionTestMessageListener notification_created_listener("created");
|
||||
const Extension* extension2 =
|
||||
LoadAppWithWindowState("notifications/api/basic_app");
|
||||
ASSERT_TRUE(extension2);
|
||||
@ -234,7 +235,7 @@ IN_PROC_BROWSER_TEST_F(AppNotificationsExtensionApiTest,
|
||||
ASSERT_FALSE(HasBadge(profile(), extension1->id()).value());
|
||||
|
||||
// Load the basic app to generate a notification.
|
||||
ExtensionTestMessageListener notification_created_listener1("created", false);
|
||||
ExtensionTestMessageListener notification_created_listener1("created");
|
||||
const Extension* extension2 =
|
||||
LoadAppWithWindowState("notifications/api/basic_app");
|
||||
ASSERT_TRUE(extension2);
|
||||
@ -249,7 +250,7 @@ IN_PROC_BROWSER_TEST_F(AppNotificationsExtensionApiTest,
|
||||
ASSERT_FALSE(HasBadge(profile(), extension1->id()).value());
|
||||
|
||||
// Re-load the basic app to generate a notification again.
|
||||
ExtensionTestMessageListener notification_created_listener2("created", false);
|
||||
ExtensionTestMessageListener notification_created_listener2("created");
|
||||
const Extension* extension3 =
|
||||
LoadAppWithWindowState("notifications/api/basic_app");
|
||||
ASSERT_TRUE(extension3);
|
||||
|
@ -76,7 +76,7 @@ class AppViewTest : public extensions::PlatformAppBrowserTest {
|
||||
return;
|
||||
}
|
||||
|
||||
ExtensionTestMessageListener done_listener("TEST_PASSED", false);
|
||||
ExtensionTestMessageListener done_listener("TEST_PASSED");
|
||||
done_listener.set_failure_message("TEST_FAILED");
|
||||
if (!content::ExecuteScript(
|
||||
embedder_web_contents,
|
||||
@ -227,7 +227,7 @@ IN_PROC_BROWSER_TEST_F(AppViewTest,
|
||||
base::StringPrintf("onAppCommand('%s', '%s');", "EMBED",
|
||||
guest_app->id().c_str())));
|
||||
ExtensionTestMessageListener on_embed_requested_listener(
|
||||
"AppViewTest.EmbedRequested", false);
|
||||
"AppViewTest.EmbedRequested");
|
||||
EXPECT_TRUE(on_embed_requested_listener.WaitUntilSatisfied());
|
||||
// While the host is waiting for the guest to accept/deny embedding, the bad
|
||||
// app sends a request to the host.
|
||||
|
@ -706,7 +706,7 @@ class WebViewTestBase : public extensions::PlatformAppBrowserTest {
|
||||
return;
|
||||
}
|
||||
|
||||
ExtensionTestMessageListener done_listener("TEST_PASSED", false);
|
||||
ExtensionTestMessageListener done_listener("TEST_PASSED");
|
||||
done_listener.set_failure_message("TEST_FAILED");
|
||||
// Note that domAutomationController may not exist for some tests so we
|
||||
// must use the async version of ExecuteScript.
|
||||
@ -765,13 +765,13 @@ class WebViewTestBase : public extensions::PlatformAppBrowserTest {
|
||||
// Create the guest.
|
||||
content::WebContents* embedder_web_contents =
|
||||
GetFirstAppWindowWebContents();
|
||||
ExtensionTestMessageListener guest_added("GuestAddedToDom", false);
|
||||
ExtensionTestMessageListener guest_added("GuestAddedToDom");
|
||||
EXPECT_TRUE(content::ExecuteScript(embedder_web_contents,
|
||||
base::StringPrintf("createGuest();\n")));
|
||||
ASSERT_TRUE(guest_added.WaitUntilSatisfied());
|
||||
|
||||
// Now load the guest.
|
||||
ExtensionTestMessageListener guest_loaded("GuestLoaded", false);
|
||||
ExtensionTestMessageListener guest_loaded("GuestLoaded");
|
||||
EXPECT_TRUE(content::ExecuteScript(
|
||||
embedder_web_contents,
|
||||
base::StringPrintf("loadGuest(%d);\n", host_and_port.port())));
|
||||
@ -803,7 +803,7 @@ class WebViewTestBase : public extensions::PlatformAppBrowserTest {
|
||||
GetFirstAppWindowWebContents();
|
||||
ASSERT_TRUE(embedder_web_contents);
|
||||
|
||||
ExtensionTestMessageListener test_run_listener("PASSED", false);
|
||||
ExtensionTestMessageListener test_run_listener("PASSED");
|
||||
test_run_listener.set_failure_message("FAILED");
|
||||
EXPECT_TRUE(
|
||||
content::ExecuteScript(
|
||||
@ -814,8 +814,7 @@ class WebViewTestBase : public extensions::PlatformAppBrowserTest {
|
||||
|
||||
// Loads an app with a <webview> in it, returns once a guest is created.
|
||||
void LoadAppWithGuest(const std::string& app_path) {
|
||||
ExtensionTestMessageListener launched_listener("WebViewTest.LAUNCHED",
|
||||
false);
|
||||
ExtensionTestMessageListener launched_listener("WebViewTest.LAUNCHED");
|
||||
launched_listener.set_failure_message("WebViewTest.FAILURE");
|
||||
LoadAndLaunchPlatformApp(app_path.c_str(), &launched_listener);
|
||||
|
||||
@ -833,8 +832,7 @@ class WebViewTestBase : public extensions::PlatformAppBrowserTest {
|
||||
const std::string& wait_message) {
|
||||
std::unique_ptr<ExtensionTestMessageListener> listener;
|
||||
if (!wait_message.empty()) {
|
||||
listener =
|
||||
std::make_unique<ExtensionTestMessageListener>(wait_message, false);
|
||||
listener = std::make_unique<ExtensionTestMessageListener>(wait_message);
|
||||
}
|
||||
|
||||
EXPECT_TRUE(
|
||||
@ -1172,7 +1170,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, SpatialNavigationJavascriptAPI) {
|
||||
base::CommandLine::ForCurrentProcess()->AppendSwitch(
|
||||
switches::kEnableSpatialNavigation);
|
||||
|
||||
ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED", false);
|
||||
ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED");
|
||||
next_step_listener.set_failure_message("TEST_STEP_FAILED");
|
||||
|
||||
LoadAndLaunchPlatformApp("web_view/spatial_navigation_state_api",
|
||||
@ -1256,8 +1254,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, ReloadEmbedder) {
|
||||
// platform_app for this test.
|
||||
LoadAppWithGuest("web_view/visibility_changed");
|
||||
|
||||
ExtensionTestMessageListener launched_again_listener("WebViewTest.LAUNCHED",
|
||||
false);
|
||||
ExtensionTestMessageListener launched_again_listener("WebViewTest.LAUNCHED");
|
||||
GetEmbedderWebContents()->GetController().Reload(content::ReloadType::NORMAL,
|
||||
false);
|
||||
ASSERT_TRUE(launched_again_listener.WaitUntilSatisfied());
|
||||
@ -1289,8 +1286,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, DisplayNoneSetSrc) {
|
||||
// Now attempt to navigate the guest again.
|
||||
SendMessageToEmbedder("navigate-guest");
|
||||
|
||||
ExtensionTestMessageListener test_passed_listener("WebViewTest.PASSED",
|
||||
false);
|
||||
ExtensionTestMessageListener test_passed_listener("WebViewTest.PASSED");
|
||||
// Making the guest visible would trigger loadstop.
|
||||
SendMessageToEmbedder("show-guest");
|
||||
EXPECT_TRUE(test_passed_listener.WaitUntilSatisfied());
|
||||
@ -1735,7 +1731,7 @@ IN_PROC_BROWSER_TEST_P(WebViewNewWindowTest,
|
||||
|
||||
// Run the test and wait until the guest WebContents is available and has
|
||||
// finished loading.
|
||||
ExtensionTestMessageListener done_listener("TEST_PASSED", false);
|
||||
ExtensionTestMessageListener done_listener("TEST_PASSED");
|
||||
done_listener.set_failure_message("TEST_FAILED");
|
||||
EXPECT_TRUE(content::ExecuteScript(
|
||||
embedder_web_contents, "runTest('testWebViewAndEmbedderInNewWindow')"));
|
||||
@ -1780,16 +1776,16 @@ IN_PROC_BROWSER_TEST_P(WebViewNewWindowTest,
|
||||
// unique across all webviews within the app.
|
||||
IN_PROC_BROWSER_TEST_P(WebViewTest, TwoIframesWebRequest) {
|
||||
ASSERT_TRUE(StartEmbeddedTestServer()); // For serving webview pages.
|
||||
ExtensionTestMessageListener ready1("ready1", true);
|
||||
ExtensionTestMessageListener ready2("ready2", true);
|
||||
ExtensionTestMessageListener ready1("ready1", ReplyBehavior::kWillReply);
|
||||
ExtensionTestMessageListener ready2("ready2", ReplyBehavior::kWillReply);
|
||||
|
||||
LoadAndLaunchPlatformApp("web_view/two_iframes_web_request", "Launched");
|
||||
EXPECT_TRUE(ready1.WaitUntilSatisfied());
|
||||
EXPECT_TRUE(ready2.WaitUntilSatisfied());
|
||||
|
||||
ExtensionTestMessageListener finished1("success1", false);
|
||||
ExtensionTestMessageListener finished1("success1");
|
||||
finished1.set_failure_message("fail1");
|
||||
ExtensionTestMessageListener finished2("success2", false);
|
||||
ExtensionTestMessageListener finished2("success2");
|
||||
finished2.set_failure_message("fail2");
|
||||
|
||||
// Reply to the listeners to start the navigations and wait for the
|
||||
@ -2116,7 +2112,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, Shim_TestRemoveWebviewOnExit) {
|
||||
|
||||
// Run the test and wait until the guest WebContents is available and has
|
||||
// finished loading.
|
||||
ExtensionTestMessageListener guest_loaded_listener("guest-loaded", false);
|
||||
ExtensionTestMessageListener guest_loaded_listener("guest-loaded");
|
||||
EXPECT_TRUE(content::ExecuteScript(
|
||||
embedder_web_contents,
|
||||
"runTest('testRemoveWebviewOnExit')"));
|
||||
@ -2340,14 +2336,14 @@ class WebViewHttpsFirstModeTest : public WebViewTest {
|
||||
void LoadUrlInGuest(const GURL& guest_url) {
|
||||
// Create the guest.
|
||||
auto* embedder_web_contents = GetFirstAppWindowWebContents();
|
||||
ExtensionTestMessageListener guest_added("GuestAddedToDom", false);
|
||||
ExtensionTestMessageListener guest_added("GuestAddedToDom");
|
||||
EXPECT_TRUE(content::ExecuteScript(embedder_web_contents,
|
||||
base::StringPrintf("createGuest();\n")));
|
||||
ASSERT_TRUE(guest_added.WaitUntilSatisfied());
|
||||
|
||||
// Now load the guest.
|
||||
content::TestNavigationObserver observer(guest_url);
|
||||
ExtensionTestMessageListener guest_loaded("GuestLoaded", false);
|
||||
ExtensionTestMessageListener guest_loaded("GuestLoaded");
|
||||
std::string command =
|
||||
base::StringPrintf("loadGuestUrl('%s');\n", guest_url.spec().c_str());
|
||||
EXPECT_TRUE(content::ExecuteScript(embedder_web_contents, command));
|
||||
@ -2650,7 +2646,7 @@ void WebViewTestBase::MediaAccessAPIAllowTestHelper(
|
||||
std::unique_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate());
|
||||
embedder_web_contents->SetDelegate(mock.get());
|
||||
|
||||
ExtensionTestMessageListener done_listener("TEST_PASSED", false);
|
||||
ExtensionTestMessageListener done_listener("TEST_PASSED");
|
||||
done_listener.set_failure_message("TEST_FAILED");
|
||||
EXPECT_TRUE(
|
||||
content::ExecuteScript(
|
||||
@ -2667,7 +2663,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, OpenURLFromTab_CurrentTab_Abort) {
|
||||
|
||||
// Verify that OpenURLFromTab with a window disposition of CURRENT_TAB will
|
||||
// navigate the current <webview>.
|
||||
ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP", false);
|
||||
ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP");
|
||||
|
||||
// Navigating to a file URL is forbidden inside a <webview>.
|
||||
content::OpenURLParams params(GURL("file://foo"), content::Referrer(),
|
||||
@ -2691,7 +2687,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, OpenURLFromTab_CurrentTab_Succeed) {
|
||||
|
||||
// Verify that OpenURLFromTab with a window disposition of CURRENT_TAB will
|
||||
// navigate the current <webview>.
|
||||
ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP", false);
|
||||
ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP");
|
||||
|
||||
GURL test_url("http://www.google.com");
|
||||
content::OpenURLParams params(
|
||||
@ -2710,8 +2706,7 @@ IN_PROC_BROWSER_TEST_P(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) {
|
||||
|
||||
// Verify that OpenURLFromTab with a window disposition of NEW_BACKGROUND_TAB
|
||||
// will trigger the <webview>'s New Window API.
|
||||
ExtensionTestMessageListener new_window_listener(
|
||||
"WebViewTest.NEWWINDOW", false);
|
||||
ExtensionTestMessageListener new_window_listener("WebViewTest.NEWWINDOW");
|
||||
|
||||
// Navigating to a file URL is forbidden inside a <webview>.
|
||||
content::OpenURLParams params(GURL("file://foo"), content::Referrer(),
|
||||
@ -2830,7 +2825,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, ContextMenusAPI_Basic) {
|
||||
ExecuteScriptWaitForTitle(embedder, "createMenuItem()", "ITEM_CREATED");
|
||||
|
||||
// 3. Click the created item, wait for the click handlers to fire from JS.
|
||||
ExtensionTestMessageListener click_listener("ITEM_CLICKED", false);
|
||||
ExtensionTestMessageListener click_listener("ITEM_CLICKED");
|
||||
GURL page_url("http://www.google.com");
|
||||
// Create and build our test context menu.
|
||||
std::unique_ptr<TestRenderViewContextMenu> menu(
|
||||
@ -2878,7 +2873,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, ContextMenusAPI_PreventDefault) {
|
||||
// Add a preventDefault() call on context menu event so context menu
|
||||
// does not show up.
|
||||
ExtensionTestMessageListener prevent_default_listener(
|
||||
"WebViewTest.CONTEXT_MENU_DEFAULT_PREVENTED", false);
|
||||
"WebViewTest.CONTEXT_MENU_DEFAULT_PREVENTED");
|
||||
EXPECT_TRUE(content::ExecuteScript(embedder, "registerPreventDefault()"));
|
||||
ContextMenuShownObserver context_menu_shown_observer;
|
||||
|
||||
@ -2948,7 +2943,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, MediaAccessAPIAllow_TestCheck) {
|
||||
std::unique_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate());
|
||||
embedder_web_contents->SetDelegate(mock.get());
|
||||
|
||||
ExtensionTestMessageListener done_listener("TEST_PASSED", false);
|
||||
ExtensionTestMessageListener done_listener("TEST_PASSED");
|
||||
done_listener.set_failure_message("TEST_FAILED");
|
||||
EXPECT_TRUE(
|
||||
content::ExecuteScript(
|
||||
@ -5351,8 +5346,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, TouchpadPinchSyntheticWheelEvents) {
|
||||
guest_contents->GetRenderWidgetHostView()->GetRenderWidgetHost());
|
||||
synchronize_threads.Wait();
|
||||
|
||||
ExtensionTestMessageListener synthetic_wheel_listener("Seen wheel event",
|
||||
false);
|
||||
ExtensionTestMessageListener synthetic_wheel_listener("Seen wheel event");
|
||||
|
||||
const gfx::Rect contents_rect = guest_contents->GetContainerBounds();
|
||||
const gfx::Point pinch_position(contents_rect.width() / 2,
|
||||
@ -5389,7 +5383,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, NoExtensionScriptsInjectedInWebview) {
|
||||
// webview's DOM has not been modified (in this case, by the extension's
|
||||
// content script).
|
||||
ExtensionTestMessageListener app_content_script_listener(
|
||||
"WebViewTest.NO_ELEMENT_INJECTED", false);
|
||||
"WebViewTest.NO_ELEMENT_INJECTED");
|
||||
app_content_script_listener.set_failure_message(
|
||||
"WebViewTest.UNKNOWN_ELEMENT_INJECTED");
|
||||
LoadAppWithGuest("web_view/a_com_webview");
|
||||
@ -5408,7 +5402,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, NoExtensionScriptsInjectedInWebview) {
|
||||
using GuestViewExtensionNameCollisionTest = extensions::ExtensionBrowserTest;
|
||||
IN_PROC_BROWSER_TEST_F(GuestViewExtensionNameCollisionTest,
|
||||
GuestViewNamesDoNotCollideWithExtensions) {
|
||||
ExtensionTestMessageListener loaded_listener("LOADED", false);
|
||||
ExtensionTestMessageListener loaded_listener("LOADED");
|
||||
const extensions::Extension* extension =
|
||||
LoadExtension(test_data_dir_.AppendASCII(
|
||||
"platform_apps/web_view/no_extension_name_collision"));
|
||||
@ -6043,8 +6037,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessWebViewTest, ContentScript) {
|
||||
}
|
||||
|
||||
// Navigate <webview> cross-site and ensure the new content script runs.
|
||||
ExtensionTestMessageListener script_listener("Hello from content script!",
|
||||
false);
|
||||
ExtensionTestMessageListener script_listener("Hello from content script!");
|
||||
const GURL second_url =
|
||||
embedded_test_server()->GetURL("b.test", "/title1.html");
|
||||
{
|
||||
@ -6129,8 +6122,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessWebViewTest, ContentScriptInOOPIF) {
|
||||
|
||||
// Navigate <webview> subframe cross-site to a URL that matches the content
|
||||
// script pattern and ensure the new content script runs.
|
||||
ExtensionTestMessageListener script_listener("Hello from content script!",
|
||||
false);
|
||||
ExtensionTestMessageListener script_listener("Hello from content script!");
|
||||
const GURL frame_url =
|
||||
embedded_test_server()->GetURL("b.test", "/title1.html");
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ class WebViewInteractiveTest : public extensions::PlatformAppBrowserTest {
|
||||
|
||||
void MoveMouseInsideWindowWithListener(gfx::Point point,
|
||||
const std::string& message) {
|
||||
ExtensionTestMessageListener move_listener(message, false);
|
||||
ExtensionTestMessageListener move_listener(message);
|
||||
ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(
|
||||
gfx::Point(corner_.x() + point.x(), corner_.y() + point.y())));
|
||||
ASSERT_TRUE(move_listener.WaitUntilSatisfied());
|
||||
@ -156,7 +156,7 @@ class WebViewInteractiveTest : public extensions::PlatformAppBrowserTest {
|
||||
|
||||
void SendMouseClickWithListener(ui_controls::MouseButton button,
|
||||
const std::string& message) {
|
||||
ExtensionTestMessageListener listener(message, false);
|
||||
ExtensionTestMessageListener listener(message);
|
||||
SendMouseClick(button);
|
||||
ASSERT_TRUE(listener.WaitUntilSatisfied());
|
||||
}
|
||||
@ -273,8 +273,8 @@ class WebViewInteractiveTest : public extensions::PlatformAppBrowserTest {
|
||||
|
||||
*embedder_web_contents = GetFirstAppWindowWebContents();
|
||||
|
||||
std::unique_ptr<ExtensionTestMessageListener> done_listener(
|
||||
new ExtensionTestMessageListener("TEST_PASSED", false));
|
||||
auto done_listener =
|
||||
std::make_unique<ExtensionTestMessageListener>("TEST_PASSED");
|
||||
done_listener->set_failure_message("TEST_FAILED");
|
||||
if (!content::ExecuteScript(
|
||||
*embedder_web_contents,
|
||||
@ -481,8 +481,7 @@ class WebViewInteractiveTest : public extensions::PlatformAppBrowserTest {
|
||||
ASSERT_TRUE(embedder_web_contents);
|
||||
ASSERT_TRUE(guest_web_contents());
|
||||
// Click the guest to request fullscreen.
|
||||
ExtensionTestMessageListener passed_listener(
|
||||
"FULLSCREEN_STEP_PASSED", false);
|
||||
ExtensionTestMessageListener passed_listener("FULLSCREEN_STEP_PASSED");
|
||||
passed_listener.set_failure_message("TEST_FAILED");
|
||||
content::SimulateMouseClickAt(guest_web_contents(), 0,
|
||||
blink::WebMouseEvent::Button::kLeft,
|
||||
@ -578,7 +577,7 @@ IN_PROC_BROWSER_TEST_F(WebViewPointerLockInteractiveTest,
|
||||
|
||||
// Click the Lock Pointer button. The first two times the button is clicked
|
||||
// the permission API will deny the request (intentional).
|
||||
ExtensionTestMessageListener exception_listener("request exception", false);
|
||||
ExtensionTestMessageListener exception_listener("request exception");
|
||||
SendMouseClickWithListener(ui_controls::LEFT, "lock error");
|
||||
ASSERT_TRUE(exception_listener.WaitUntilSatisfied());
|
||||
SendMouseClickWithListener(ui_controls::LEFT, "lock error");
|
||||
@ -601,7 +600,7 @@ IN_PROC_BROWSER_TEST_F(WebViewPointerLockInteractiveTest,
|
||||
MoveMouseInsideWindowWithListener(gfx::Point(75, 25), "mouse-move");
|
||||
#endif
|
||||
|
||||
ExtensionTestMessageListener unlocked_listener("unlocked", false);
|
||||
ExtensionTestMessageListener unlocked_listener("unlocked");
|
||||
// Send a key press to unlock the mouse.
|
||||
SendKeyPressToPlatformApp(ui::VKEY_ESCAPE);
|
||||
|
||||
@ -612,8 +611,8 @@ IN_PROC_BROWSER_TEST_F(WebViewPointerLockInteractiveTest,
|
||||
// webview object. main.js then removes the div containing the webview, which
|
||||
// should unlock, and leave the mouse over the mousemove-capture-container
|
||||
// div. We then move the mouse over that div to ensure the mouse was properly
|
||||
// unlocked and that the div receieves the message.
|
||||
ExtensionTestMessageListener move_captured_listener("move-captured", false);
|
||||
// unlocked and that the div receives the message.
|
||||
ExtensionTestMessageListener move_captured_listener("move-captured");
|
||||
move_captured_listener.set_failure_message("timeout");
|
||||
|
||||
// Mouse should already be over lock button (since we just unlocked), so send
|
||||
@ -632,7 +631,7 @@ IN_PROC_BROWSER_TEST_F(WebViewPointerLockInteractiveTest,
|
||||
fprintf(stderr, "TIMEOUT - retrying\n");
|
||||
// About 1 in 40 tests fail to detect mouse moves at this point (why?).
|
||||
// Sending a right click seems to fix this (why?).
|
||||
ExtensionTestMessageListener move_listener2("move-captured", false);
|
||||
ExtensionTestMessageListener move_listener2("move-captured");
|
||||
SendMouseClick(ui_controls::RIGHT);
|
||||
ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(
|
||||
gfx::Point(corner().x() + 51, corner().y() + 11)));
|
||||
@ -655,7 +654,7 @@ IN_PROC_BROWSER_TEST_F(WebViewPointerLockInteractiveTest,
|
||||
SendMouseClickWithListener(ui_controls::LEFT, "locked");
|
||||
|
||||
// Try to unlock the mouse now that the focus is outside of the BrowserPlugin
|
||||
ExtensionTestMessageListener unlocked_listener("unlocked", false);
|
||||
ExtensionTestMessageListener unlocked_listener("unlocked");
|
||||
// Send a key press to unlock the mouse.
|
||||
SendKeyPressToPlatformApp(ui::VKEY_ESCAPE);
|
||||
|
||||
@ -690,7 +689,7 @@ IN_PROC_BROWSER_TEST_F(WebViewFocusInteractiveTest, Focus_FocusTakeFocus) {
|
||||
embedder_web_contents(),
|
||||
"domAutomationController.send(Math.floor(window.clickY));", &clickY));
|
||||
|
||||
ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED", false);
|
||||
ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED");
|
||||
next_step_listener.set_failure_message("TEST_STEP_FAILED");
|
||||
content::SimulateMouseClickAt(guest_web_contents(), 0,
|
||||
blink::WebMouseEvent::Button::kLeft,
|
||||
@ -721,7 +720,7 @@ IN_PROC_BROWSER_TEST_F(WebViewFocusInteractiveTest,
|
||||
&embedder_web_contents));
|
||||
EXPECT_TRUE(done_listener->WaitUntilSatisfied());
|
||||
|
||||
ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED", false);
|
||||
ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED");
|
||||
next_step_listener.set_failure_message("TEST_STEP_FAILED");
|
||||
EXPECT_TRUE(content::ExecuteScript(
|
||||
embedder_web_contents,
|
||||
@ -747,7 +746,7 @@ IN_PROC_BROWSER_TEST_F(WebViewFocusInteractiveTest, Focus_AdvanceFocus) {
|
||||
}
|
||||
|
||||
{
|
||||
ExtensionTestMessageListener listener("button1-focused", false);
|
||||
ExtensionTestMessageListener listener("button1-focused");
|
||||
listener.set_failure_message("TEST_FAILED");
|
||||
|
||||
// In oopif-webview, the click it directly routed to the guest.
|
||||
@ -766,7 +765,7 @@ IN_PROC_BROWSER_TEST_F(WebViewFocusInteractiveTest, Focus_AdvanceFocus) {
|
||||
{
|
||||
// Wait for button1 to be focused again, this means we were asked to
|
||||
// move the focus to the next focusable element.
|
||||
ExtensionTestMessageListener listener("button1-advance-focus", false);
|
||||
ExtensionTestMessageListener listener("button1-advance-focus");
|
||||
listener.set_failure_message("TEST_FAILED");
|
||||
content::SimulateKeyPress(embedder_web_contents, ui::DomKey::TAB,
|
||||
ui::DomCode::TAB, ui::VKEY_TAB, false, false,
|
||||
@ -846,7 +845,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, EditCommands) {
|
||||
// Flush any pending events to make sure we start with a clean slate.
|
||||
content::RunAllPendingInMessageLoop();
|
||||
|
||||
ExtensionTestMessageListener copy_listener("copy", false);
|
||||
ExtensionTestMessageListener copy_listener("copy");
|
||||
SendCopyKeyPressToPlatformApp();
|
||||
|
||||
// Wait for the guest to receive a 'copy' edit command.
|
||||
@ -866,7 +865,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, DISABLED_EditCommandsNoMenu) {
|
||||
// Flush any pending events to make sure we start with a clean slate.
|
||||
content::RunAllPendingInMessageLoop();
|
||||
|
||||
ExtensionTestMessageListener start_of_line_listener("StartOfLine", false);
|
||||
ExtensionTestMessageListener start_of_line_listener("StartOfLine");
|
||||
SendStartOfLineKeyPressToPlatformApp();
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
// On macOS, sending an accelerator [key-down] will also cause the subsequent
|
||||
@ -893,7 +892,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, DISABLED_EditCommandsNoMenu) {
|
||||
IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, MAYBE_NewWindow_OpenInNewTab) {
|
||||
content::WebContents* embedder_web_contents = nullptr;
|
||||
|
||||
ExtensionTestMessageListener loaded_listener("Loaded", false);
|
||||
ExtensionTestMessageListener loaded_listener("Loaded");
|
||||
std::unique_ptr<ExtensionTestMessageListener> done_listener(
|
||||
RunAppHelper("testNewWindowOpenInNewTab", "web_view/newwindow",
|
||||
NEEDS_TEST_SERVER, &embedder_web_contents));
|
||||
@ -949,13 +948,10 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, Navigation_BackForwardKeys) {
|
||||
content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents();
|
||||
ASSERT_TRUE(embedder_web_contents);
|
||||
|
||||
ExtensionTestMessageListener done_listener(
|
||||
"TEST_PASSED", false);
|
||||
ExtensionTestMessageListener done_listener("TEST_PASSED");
|
||||
done_listener.set_failure_message("TEST_FAILED");
|
||||
ExtensionTestMessageListener ready_back_key_listener(
|
||||
"ReadyForBackKey", false);
|
||||
ExtensionTestMessageListener ready_forward_key_listener(
|
||||
"ReadyForForwardKey", false);
|
||||
ExtensionTestMessageListener ready_back_key_listener("ReadyForBackKey");
|
||||
ExtensionTestMessageListener ready_forward_key_listener("ReadyForForwardKey");
|
||||
|
||||
EXPECT_TRUE(content::ExecuteScript(
|
||||
embedder_web_contents,
|
||||
@ -1059,7 +1055,7 @@ IN_PROC_BROWSER_TEST_F(WebViewFocusInteractiveTest, Focus_FocusRestored) {
|
||||
ASSERT_TRUE(guest_web_contents());
|
||||
|
||||
// 1) We click on the guest so that we get a focus event.
|
||||
ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED", false);
|
||||
ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED");
|
||||
next_step_listener.set_failure_message("TEST_STEP_FAILED");
|
||||
{
|
||||
content::SimulateMouseClickAt(guest_web_contents(), 0,
|
||||
@ -1134,7 +1130,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, MAYBE_Focus_InputMethod) {
|
||||
->GetTextInputClient();
|
||||
ASSERT_TRUE(text_input_client);
|
||||
|
||||
ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED", false);
|
||||
ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED");
|
||||
next_step_listener.set_failure_message("TEST_STEP_FAILED");
|
||||
|
||||
// An input element inside the <webview> gets focus and is given some
|
||||
@ -1263,7 +1259,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, TextSelection) {
|
||||
GetPlatformAppWindow()));
|
||||
|
||||
// Wait until guest sees a context menu.
|
||||
ExtensionTestMessageListener ctx_listener("MSG_CONTEXTMENU", false);
|
||||
ExtensionTestMessageListener ctx_listener("MSG_CONTEXTMENU");
|
||||
ContextMenuWaiter menu_observer;
|
||||
SimulateRWHMouseClick(guest_web_contents()->GetRenderViewHost()->GetWidget(),
|
||||
blink::WebMouseEvent::Button::kRight, 20, 20);
|
||||
@ -1318,14 +1314,14 @@ IN_PROC_BROWSER_TEST_F(WebViewFocusInteractiveTest, MAYBE_FocusAndVisibility) {
|
||||
LoadAndLaunchPlatformApp("web_view/focus_visibility",
|
||||
"WebViewInteractiveTest.LOADED");
|
||||
ExtensionTestMessageListener test_init_listener(
|
||||
"WebViewInteractiveTest.WebViewInitialized", false);
|
||||
"WebViewInteractiveTest.WebViewInitialized");
|
||||
SendMessageToEmbedder("init-oopif");
|
||||
EXPECT_TRUE(test_init_listener.WaitUntilSatisfied());
|
||||
|
||||
// Send several tab-keys. The button inside webview should receive focus at
|
||||
// least once.
|
||||
ExtensionTestMessageListener key_processed_listener(
|
||||
"WebViewInteractiveTest.KeyUp", false);
|
||||
"WebViewInteractiveTest.KeyUp");
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
// On mac, the event listener seems one key event behind and deadlocks. Send
|
||||
// an extra tab to get things unblocked. See http://crbug.com/685281 when
|
||||
@ -1340,19 +1336,19 @@ IN_PROC_BROWSER_TEST_F(WebViewFocusInteractiveTest, MAYBE_FocusAndVisibility) {
|
||||
|
||||
// Verify that the button in the guest receives focus.
|
||||
ExtensionTestMessageListener webview_button_focused_listener(
|
||||
"WebViewInteractiveTest.WebViewButtonWasFocused", false);
|
||||
"WebViewInteractiveTest.WebViewButtonWasFocused");
|
||||
webview_button_focused_listener.set_failure_message(
|
||||
"WebViewInteractiveTest.WebViewButtonWasNotFocused");
|
||||
SendMessageToEmbedder("verify");
|
||||
EXPECT_TRUE(webview_button_focused_listener.WaitUntilSatisfied());
|
||||
|
||||
// Reset the test and now make the <webview> invisible.
|
||||
ExtensionTestMessageListener reset_listener("WebViewInteractiveTest.DidReset",
|
||||
false);
|
||||
ExtensionTestMessageListener reset_listener(
|
||||
"WebViewInteractiveTest.DidReset");
|
||||
SendMessageToEmbedder("reset");
|
||||
EXPECT_TRUE(reset_listener.WaitUntilSatisfied());
|
||||
ExtensionTestMessageListener did_hide_webview_listener(
|
||||
"WebViewInteractiveTest.DidHideWebView", false);
|
||||
"WebViewInteractiveTest.DidHideWebView");
|
||||
SendMessageToEmbedder("hide-webview");
|
||||
EXPECT_TRUE(did_hide_webview_listener.WaitUntilSatisfied());
|
||||
|
||||
@ -1364,7 +1360,7 @@ IN_PROC_BROWSER_TEST_F(WebViewFocusInteractiveTest, MAYBE_FocusAndVisibility) {
|
||||
EXPECT_TRUE(key_processed_listener.WaitUntilSatisfied());
|
||||
}
|
||||
ExtensionTestMessageListener webview_button_not_focused_listener(
|
||||
"WebViewInteractiveTest.WebViewButtonWasNotFocused", false);
|
||||
"WebViewInteractiveTest.WebViewButtonWasNotFocused");
|
||||
webview_button_not_focused_listener.set_failure_message(
|
||||
"WebViewInteractiveTest.WebViewButtonWasFocused");
|
||||
SendMessageToEmbedder("verify");
|
||||
@ -1385,7 +1381,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, MAYBE_KeyboardFocusSimple) {
|
||||
|
||||
EXPECT_EQ(embedder_web_contents()->GetFocusedFrame(),
|
||||
embedder_web_contents()->GetMainFrame());
|
||||
ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED", false);
|
||||
ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED");
|
||||
next_step_listener.set_failure_message("TEST_STEP_FAILED");
|
||||
{
|
||||
gfx::Rect offset = embedder_web_contents()->GetContainerBounds();
|
||||
@ -1432,7 +1428,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, MAYBE_KeyboardFocusWindowCycle) {
|
||||
|
||||
EXPECT_EQ(embedder_web_contents()->GetFocusedFrame(),
|
||||
embedder_web_contents()->GetMainFrame());
|
||||
ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED", false);
|
||||
ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED");
|
||||
next_step_listener.set_failure_message("TEST_STEP_FAILED");
|
||||
{
|
||||
gfx::Rect offset = embedder_web_contents()->GetContainerBounds();
|
||||
@ -1509,8 +1505,7 @@ IN_PROC_BROWSER_TEST_F(WebViewImeInteractiveTest,
|
||||
|
||||
// Click the <input> element inside the <webview>. In its focus handle, the
|
||||
// <input> inside the <webview> initializes its value to "A B X D".
|
||||
ExtensionTestMessageListener focus_listener("WebViewImeTest.InputFocused",
|
||||
false);
|
||||
ExtensionTestMessageListener focus_listener("WebViewImeTest.InputFocused");
|
||||
content::WebContents* target_web_contents = guest_web_contents;
|
||||
WaitForHitTestData(guest_web_contents);
|
||||
|
||||
@ -1532,8 +1527,7 @@ IN_PROC_BROWSER_TEST_F(WebViewImeInteractiveTest,
|
||||
// Now commit "C" to to replace the range (4, 5).
|
||||
// For OOPIF guests, the target for IME is the RWH for the guest's main frame.
|
||||
// For BrowserPlugin-based guests, input always goes to the embedder.
|
||||
ExtensionTestMessageListener input_listener("WebViewImetest.InputReceived",
|
||||
false);
|
||||
ExtensionTestMessageListener input_listener("WebViewImetest.InputReceived");
|
||||
content::RenderWidgetHost* target_rwh_for_input =
|
||||
target_web_contents->GetRenderWidgetHostView()->GetRenderWidgetHost();
|
||||
content::SendImeCommitTextToWidget(target_rwh_for_input, u"C",
|
||||
@ -1568,8 +1562,7 @@ IN_PROC_BROWSER_TEST_F(WebViewImeInteractiveTest, CompositionRangeUpdates) {
|
||||
|
||||
// Click the <input> element inside the <webview>. In its focus handle, the
|
||||
// <input> inside the <webview> initializes its value to "A B X D".
|
||||
ExtensionTestMessageListener focus_listener("WebViewImeTest.InputFocused",
|
||||
false);
|
||||
ExtensionTestMessageListener focus_listener("WebViewImeTest.InputFocused");
|
||||
content::WebContents* embedder_web_contents =
|
||||
guest_view::GuestViewBase::FromWebContents(guest_web_contents)
|
||||
->embedder_web_contents();
|
||||
|
@ -128,7 +128,7 @@ IN_PROC_BROWSER_TEST_F(ArcAppsPrivateApiTest, OnInstalled) {
|
||||
// newly installed app.
|
||||
SetCustomArg("Package_0");
|
||||
extensions::ResultCatcher catcher;
|
||||
ExtensionTestMessageListener ready_listener("ready", false);
|
||||
ExtensionTestMessageListener ready_listener("ready");
|
||||
|
||||
base::FilePath path =
|
||||
test_data_dir_.AppendASCII("arc_app_launcher/install_event");
|
||||
|
@ -111,7 +111,7 @@ class MediaGalleriesGalleryWatchApiTest : public extensions::ExtensionApiTest {
|
||||
|
||||
void ExecuteCmdAndCheckReply(const std::string& js_command,
|
||||
const std::string& ok_message) {
|
||||
ExtensionTestMessageListener listener(ok_message, false);
|
||||
ExtensionTestMessageListener listener(ok_message);
|
||||
background_main_frame_->ExecuteJavaScriptForTests(
|
||||
base::ASCIIToUTF16(js_command), base::NullCallback());
|
||||
EXPECT_TRUE(listener.WaitUntilSatisfied());
|
||||
@ -129,8 +129,7 @@ class MediaGalleriesGalleryWatchApiTest : public extensions::ExtensionApiTest {
|
||||
? kAddGalleryWatchRequestSucceeded
|
||||
: kAddGalleryWatchRequestFailed;
|
||||
|
||||
ExtensionTestMessageListener add_gallery_watch_finished(
|
||||
expected_result, false /* no reply */);
|
||||
ExtensionTestMessageListener add_gallery_watch_finished(expected_result);
|
||||
ExecuteCmdAndCheckReply(kSetupWatchOnValidGalleriesCmd, kAddGalleryWatchOK);
|
||||
EXPECT_TRUE(add_gallery_watch_finished.WaitUntilSatisfied());
|
||||
}
|
||||
@ -169,7 +168,7 @@ class MediaGalleriesGalleryWatchApiTest : public extensions::ExtensionApiTest {
|
||||
|
||||
void FetchMediaGalleriesList() {
|
||||
ExtensionTestMessageListener get_media_systems_finished(
|
||||
kGetMediaFileSystemsCallbackOK, false /* no reply */);
|
||||
kGetMediaFileSystemsCallbackOK);
|
||||
ExecuteCmdAndCheckReply(kGetMediaFileSystemsCmd, kGetMediaFileSystemsOK);
|
||||
EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied());
|
||||
}
|
||||
@ -200,7 +199,7 @@ IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest,
|
||||
|
||||
// Modify gallery contents.
|
||||
ExtensionTestMessageListener gallery_change_event_received(
|
||||
kGalleryChangedEventReceived, false /* no reply */);
|
||||
kGalleryChangedEventReceived);
|
||||
|
||||
ASSERT_TRUE(AddNewFileInTestGallery());
|
||||
if (GalleryWatchesSupported())
|
||||
@ -234,8 +233,7 @@ IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest,
|
||||
SetupGalleryWatches();
|
||||
|
||||
// Modify gallery contents; expect correct details.
|
||||
ExtensionTestMessageListener got_correct_details(kOnGalleryChangedCheckingOK,
|
||||
false);
|
||||
ExtensionTestMessageListener got_correct_details(kOnGalleryChangedCheckingOK);
|
||||
ASSERT_TRUE(AddNewFileInTestGallery());
|
||||
EXPECT_TRUE(got_correct_details.WaitUntilSatisfied());
|
||||
}
|
||||
@ -261,7 +259,7 @@ IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest,
|
||||
|
||||
// Modify gallery contents.
|
||||
ExtensionTestMessageListener gallery_change_event_received(
|
||||
kGalleryChangedEventReceived, false /* no reply */);
|
||||
kGalleryChangedEventReceived);
|
||||
ASSERT_TRUE(AddNewFileInTestGallery());
|
||||
EXPECT_TRUE(gallery_change_event_received.WaitUntilSatisfied());
|
||||
|
||||
@ -294,7 +292,7 @@ IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest,
|
||||
// Modify gallery contents. Listener should not get called because add watch
|
||||
// request was not called.
|
||||
ExtensionTestMessageListener gallery_change_event_received(
|
||||
kGalleryChangedEventReceived, false /* no reply */);
|
||||
kGalleryChangedEventReceived);
|
||||
ASSERT_TRUE(AddNewFileInTestGallery());
|
||||
|
||||
// Remove gallery watch listener.
|
||||
|
@ -157,11 +157,11 @@ class SyncFileSystemTest : public extensions::PlatformAppBrowserTest,
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(SyncFileSystemTest, AuthorizationTest) {
|
||||
ExtensionTestMessageListener open_failure("checkpoint: Failed to get syncfs",
|
||||
true);
|
||||
ReplyBehavior::kWillReply);
|
||||
ExtensionTestMessageListener bar_created("checkpoint: \"/bar\" created",
|
||||
true);
|
||||
ReplyBehavior::kWillReply);
|
||||
ExtensionTestMessageListener foo_created("checkpoint: \"/foo\" created",
|
||||
true);
|
||||
ReplyBehavior::kWillReply);
|
||||
extensions::ResultCatcher catcher;
|
||||
|
||||
LoadAndLaunchPlatformApp("sync_file_system/authorization_test", "Launched");
|
||||
|
@ -370,7 +370,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenu) {
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, InstalledAppWithContextMenu) {
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
InstallAndLaunchPlatformApp("context_menu");
|
||||
|
||||
// Wait for the extension to tell us it's initialized its context menus and
|
||||
@ -471,8 +471,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuClicked) {
|
||||
ASSERT_TRUE(menu->HasCommandWithId(extensions_custom_id));
|
||||
|
||||
// Execute the menu item
|
||||
ExtensionTestMessageListener onclicked_listener("onClicked fired for id1",
|
||||
false);
|
||||
ExtensionTestMessageListener onclicked_listener("onClicked fired for id1");
|
||||
menu->ExecuteCommand(extensions_custom_id, 0);
|
||||
|
||||
ASSERT_TRUE(onclicked_listener.WaitUntilSatisfied());
|
||||
@ -1000,7 +999,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_ConstrainedWindowRequest) {
|
||||
|
||||
// Close the constrained window and wait for the reply to the permission
|
||||
// request.
|
||||
ExtensionTestMessageListener listener("PermissionRequestDone", false);
|
||||
ExtensionTestMessageListener listener("PermissionRequestDone");
|
||||
WebContentsModalDialogManager::TestApi test_api(
|
||||
web_contents_modal_dialog_manager);
|
||||
test_api.CloseAllDialogs();
|
||||
@ -1010,14 +1009,15 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_ConstrainedWindowRequest) {
|
||||
// Tests that an app calling chrome.runtime.reload will reload the app and
|
||||
// relaunch it if it was running.
|
||||
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ReloadRelaunches) {
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
const Extension* extension =
|
||||
LoadAndLaunchPlatformApp("reload", &launched_listener);
|
||||
ASSERT_TRUE(extension);
|
||||
ASSERT_TRUE(GetFirstAppWindow());
|
||||
|
||||
// Now tell the app to reload itself.
|
||||
ExtensionTestMessageListener launched_listener2("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener2("Launched");
|
||||
launched_listener.Reply("reload");
|
||||
ASSERT_TRUE(launched_listener2.WaitUntilSatisfied());
|
||||
ASSERT_TRUE(GetFirstAppWindow());
|
||||
@ -1026,7 +1026,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ReloadRelaunches) {
|
||||
// Tests that reloading a component app loads its (lazy) background page.
|
||||
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
|
||||
ComponentReloadLoadsLazyBackgroundPage) {
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
const Extension* component_app = LoadExtensionAsComponentWithManifest(
|
||||
test_data_dir_.AppendASCII("platform_apps")
|
||||
.AppendASCII("component_reload"),
|
||||
@ -1035,7 +1036,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
|
||||
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
|
||||
|
||||
// Now tell the app to reload itself.
|
||||
ExtensionTestMessageListener launched_listener2("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener2("Launched");
|
||||
launched_listener.Reply("reload");
|
||||
ASSERT_TRUE(launched_listener2.WaitUntilSatisfied());
|
||||
}
|
||||
@ -1095,7 +1096,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
|
||||
app_loaded_observer.Wait();
|
||||
ASSERT_TRUE(should_install.seen());
|
||||
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
apps::AppServiceProxyFactory::GetForProfile(browser()->profile())
|
||||
->BrowserAppLauncher()
|
||||
->LaunchAppWithParamsForTesting(apps::AppLaunchParams(
|
||||
@ -1120,7 +1121,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, PRE_ComponentAppBackgroundPage) {
|
||||
test_data_dir_.AppendASCII("platform_apps").AppendASCII("component"));
|
||||
ASSERT_TRUE(extension);
|
||||
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
apps::AppServiceProxyFactory::GetForProfile(browser()->profile())
|
||||
->BrowserAppLauncher()
|
||||
->LaunchAppWithParamsForTesting(apps::AppLaunchParams(
|
||||
@ -1161,7 +1162,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ComponentAppBackgroundPage) {
|
||||
app_loaded_observer.Wait();
|
||||
ASSERT_TRUE(should_install.seen());
|
||||
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
apps::AppServiceProxyFactory::GetForProfile(browser()->profile())
|
||||
->BrowserAppLauncher()
|
||||
->LaunchAppWithParamsForTesting(apps::AppLaunchParams(
|
||||
@ -1189,7 +1190,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
|
||||
app_loaded_observer.Wait();
|
||||
|
||||
{
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
apps::AppServiceProxyFactory::GetForProfile(browser()->profile())
|
||||
->BrowserAppLauncher()
|
||||
->LaunchAppWithParamsForTesting(apps::AppLaunchParams(
|
||||
@ -1200,7 +1201,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
|
||||
}
|
||||
|
||||
{
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
ASSERT_TRUE(ExecuteScriptInBackgroundPageNoWait(
|
||||
extension->id(),
|
||||
// NoWait actually waits for a domAutomationController.send() which is
|
||||
@ -1385,14 +1386,14 @@ IN_PROC_BROWSER_TEST_F(RestartDeviceTest, Restart) {
|
||||
EnterKioskSession();
|
||||
ASSERT_EQ(0, num_request_restart_calls());
|
||||
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
const Extension* extension =
|
||||
LoadAndLaunchPlatformApp("restart_device", &launched_listener);
|
||||
ASSERT_TRUE(extension);
|
||||
|
||||
launched_listener.Reply("restart");
|
||||
ExtensionTestMessageListener restart_requested_listener("restartRequested",
|
||||
false);
|
||||
ExtensionTestMessageListener restart_requested_listener("restartRequested");
|
||||
ASSERT_TRUE(restart_requested_listener.WaitUntilSatisfied());
|
||||
|
||||
EXPECT_EQ(1, num_request_restart_calls());
|
||||
@ -1443,7 +1444,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppsIgnoreDefaultZoom) {
|
||||
// Launch another window. This is a simple way to guarantee that any messages
|
||||
// that would have been delivered to the app renderer and back for zoom have
|
||||
// made it through.
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
LaunchPlatformApp(extension);
|
||||
EXPECT_TRUE(launched_listener.WaitUntilSatisfied());
|
||||
|
||||
@ -1495,8 +1496,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
|
||||
web_contents->GetRenderWidgetHostView()->GetRenderWidgetHost());
|
||||
synchronize_threads.Wait();
|
||||
|
||||
ExtensionTestMessageListener synthetic_wheel_listener("Seen wheel event",
|
||||
false);
|
||||
ExtensionTestMessageListener synthetic_wheel_listener("Seen wheel event");
|
||||
|
||||
const gfx::Rect contents_rect = web_contents->GetContainerBounds();
|
||||
const gfx::Point pinch_position(contents_rect.width() / 2,
|
||||
|
@ -119,7 +119,7 @@ const Extension* PlatformAppBrowserTest::LoadAndLaunchPlatformApp(
|
||||
const Extension* PlatformAppBrowserTest::LoadAndLaunchPlatformApp(
|
||||
const char* name,
|
||||
const std::string& message) {
|
||||
ExtensionTestMessageListener launched_listener(message, false);
|
||||
ExtensionTestMessageListener launched_listener(message);
|
||||
const Extension* extension =
|
||||
LoadAndLaunchPlatformApp(name, &launched_listener);
|
||||
|
||||
@ -275,8 +275,9 @@ void PlatformAppBrowserTest::CallAdjustBoundsToBeVisibleOnScreenForAppWindow(
|
||||
|
||||
AppWindow* PlatformAppBrowserTest::CreateTestAppWindow(
|
||||
const std::string& window_create_options) {
|
||||
ExtensionTestMessageListener launched_listener("launched", true);
|
||||
ExtensionTestMessageListener loaded_listener("window_loaded", false);
|
||||
ExtensionTestMessageListener launched_listener("launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
ExtensionTestMessageListener loaded_listener("window_loaded");
|
||||
|
||||
// Load and launch the test app.
|
||||
const Extension* extension =
|
||||
|
@ -12,7 +12,8 @@
|
||||
class ExtensionPointerLockTest : public extensions::PlatformAppBrowserTest {
|
||||
public:
|
||||
bool RunExtensionPointerLockTest(const char* app_path) {
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
LoadAndLaunchPlatformApp(app_path, &launched_listener);
|
||||
|
||||
extensions::ResultCatcher catcher;
|
||||
|
@ -430,7 +430,7 @@ IN_PROC_BROWSER_TEST_F(AppShimInteractiveTest, MAYBE_Launch) {
|
||||
|
||||
// Case 2: Launch the shim, it should start the app.
|
||||
{
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
base::CommandLine shim_cmdline(base::CommandLine::NO_PROGRAM);
|
||||
shim_cmdline.AppendSwitch(app_mode::kLaunchedForTest);
|
||||
NSRunningApplication* shim_app = base::mac::OpenApplicationWithPath(
|
||||
@ -480,7 +480,7 @@ IN_PROC_BROWSER_TEST_F(AppShimInteractiveTest, MAYBE_ShowWindow) {
|
||||
// Launch the app. It should create a hidden window, but the shim should not
|
||||
// launch.
|
||||
{
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
LaunchPlatformApp(app);
|
||||
EXPECT_TRUE(launched_listener.WaitUntilSatisfied());
|
||||
}
|
||||
@ -519,7 +519,7 @@ IN_PROC_BROWSER_TEST_F(AppShimInteractiveTest, MAYBE_ShowWindow) {
|
||||
|
||||
// Launch a second window. It should not launch the shim.
|
||||
{
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
LaunchPlatformApp(app);
|
||||
EXPECT_TRUE(launched_listener.WaitUntilSatisfied());
|
||||
}
|
||||
@ -651,7 +651,7 @@ IN_PROC_BROWSER_TEST_F(AppShimInteractiveTest, MAYBE_RebuildShim) {
|
||||
// rebuild the shim.
|
||||
// (3) After rebuilding, Chrome again launches the shim and expects it to
|
||||
// behave normally.
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
base::CommandLine shim_cmdline(base::CommandLine::NO_PROGRAM);
|
||||
NSRunningApplication* shim_app = base::mac::OpenApplicationWithPath(
|
||||
shim_path, shim_cmdline, NSWorkspaceLaunchDefault);
|
||||
|
@ -56,7 +56,7 @@ class AppShimQuitTest : public PlatformAppBrowserTest {
|
||||
|
||||
void SetUpAppShim() {
|
||||
ASSERT_EQ(0u, [[NSApp windows] count]);
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
|
||||
ASSERT_EQ(1u, [[NSApp windows] count]);
|
||||
|
||||
|
@ -101,7 +101,8 @@ class AppWindowAPITest : public extensions::PlatformAppBrowserTest {
|
||||
if (!BeginAppWindowAPITest(testName))
|
||||
return false;
|
||||
|
||||
ExtensionTestMessageListener round_trip_listener("WaitForRoundTrip", true);
|
||||
ExtensionTestMessageListener round_trip_listener("WaitForRoundTrip",
|
||||
ReplyBehavior::kWillReply);
|
||||
if (!round_trip_listener.WaitUntilSatisfied()) {
|
||||
message_ = "Did not get the 'WaitForRoundTrip' message.";
|
||||
return false;
|
||||
@ -120,7 +121,8 @@ class AppWindowAPITest : public extensions::PlatformAppBrowserTest {
|
||||
|
||||
private:
|
||||
bool BeginAppWindowAPITest(const char* testName) {
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
LoadAndLaunchPlatformApp("window_api", &launched_listener);
|
||||
if (!launched_listener.WaitUntilSatisfied()) {
|
||||
message_ = "Did not get the 'Launched' message.";
|
||||
@ -216,7 +218,8 @@ IN_PROC_BROWSER_TEST_F(AppWindowAPITest,
|
||||
// test will check if the geometry cache entry for the test window has
|
||||
// changed. When the change happens, the test will let the app know so it can
|
||||
// continue running.
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
|
||||
content::WindowedNotificationObserver app_loaded_observer(
|
||||
content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
|
||||
@ -233,7 +236,8 @@ IN_PROC_BROWSER_TEST_F(AppWindowAPITest,
|
||||
WindowOpenDisposition::NEW_WINDOW,
|
||||
apps::mojom::LaunchSource::kFromTest));
|
||||
|
||||
ExtensionTestMessageListener geometry_listener("ListenGeometryChange", true);
|
||||
ExtensionTestMessageListener geometry_listener("ListenGeometryChange",
|
||||
ReplyBehavior::kWillReply);
|
||||
|
||||
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
|
||||
launched_listener.Reply("testRestoreAfterGeometryCacheChange");
|
||||
|
@ -33,7 +33,8 @@ using extensions::AppWindow;
|
||||
using extensions::NativeAppWindow;
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenWindow) {
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
LoadAndLaunchPlatformApp("leave_fullscreen", &launched_listener);
|
||||
|
||||
// We start by making sure the window is actually focused.
|
||||
@ -70,7 +71,8 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenWindow) {
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenDOM) {
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
LoadAndLaunchPlatformApp("leave_fullscreen", &launched_listener);
|
||||
|
||||
// We start by making sure the window is actually focused.
|
||||
@ -115,7 +117,8 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenDOM) {
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
|
||||
ESCDoesNotLeaveFullscreenWindow) {
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
LoadAndLaunchPlatformApp("prevent_leave_fullscreen", &launched_listener);
|
||||
|
||||
// We start by making sure the window is actually focused.
|
||||
@ -142,7 +145,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
|
||||
|
||||
ASSERT_TRUE(SimulateKeyPress(ui::VKEY_ESCAPE));
|
||||
|
||||
ExtensionTestMessageListener second_key_listener("B_KEY_RECEIVED", false);
|
||||
ExtensionTestMessageListener second_key_listener("B_KEY_RECEIVED");
|
||||
|
||||
ASSERT_TRUE(SimulateKeyPress(ui::VKEY_B));
|
||||
|
||||
@ -156,7 +159,8 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCDoesNotLeaveFullscreenDOM) {
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
LoadAndLaunchPlatformApp("prevent_leave_fullscreen", &launched_listener);
|
||||
|
||||
// We start by making sure the window is actually focused.
|
||||
@ -190,7 +194,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCDoesNotLeaveFullscreenDOM) {
|
||||
|
||||
ASSERT_TRUE(SimulateKeyPress(ui::VKEY_ESCAPE));
|
||||
|
||||
ExtensionTestMessageListener second_key_listener("B_KEY_RECEIVED", false);
|
||||
ExtensionTestMessageListener second_key_listener("B_KEY_RECEIVED");
|
||||
|
||||
ASSERT_TRUE(SimulateKeyPress(ui::VKEY_B));
|
||||
|
||||
@ -208,7 +212,8 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCDoesNotLeaveFullscreenDOM) {
|
||||
// and 'overrideEscFullscreen'.
|
||||
IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
|
||||
ESCDoesNotLeaveFullscreenOldPermission) {
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
LoadAndLaunchPlatformApp("prevent_leave_fullscreen_old", &launched_listener);
|
||||
|
||||
// We start by making sure the window is actually focused.
|
||||
@ -235,7 +240,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
|
||||
|
||||
ASSERT_TRUE(SimulateKeyPress(ui::VKEY_ESCAPE));
|
||||
|
||||
ExtensionTestMessageListener second_key_listener("B_KEY_RECEIVED", false);
|
||||
ExtensionTestMessageListener second_key_listener("B_KEY_RECEIVED");
|
||||
|
||||
ASSERT_TRUE(SimulateKeyPress(ui::VKEY_B));
|
||||
|
||||
@ -262,7 +267,8 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, MAYBE_TestInnerBounds) {
|
||||
|
||||
void AppWindowInteractiveTest::TestOuterBoundsHelper(
|
||||
const std::string& frame_type) {
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
const extensions::Extension* app =
|
||||
LoadAndLaunchPlatformApp("outer_bounds", &launched_listener);
|
||||
|
||||
@ -381,15 +387,17 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, TestDrawAttention) {
|
||||
IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, TestCreateHidden) {
|
||||
// Created hidden both times.
|
||||
{
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
LoadAndLaunchPlatformApp("hidden_with_id", &launched_listener);
|
||||
EXPECT_TRUE(launched_listener.WaitUntilSatisfied());
|
||||
ExtensionTestMessageListener create_listener_1("Launched", true);
|
||||
ExtensionTestMessageListener create_listener_1("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
launched_listener.Reply("createHidden");
|
||||
EXPECT_TRUE(create_listener_1.WaitUntilSatisfied());
|
||||
AppWindow* app_window = GetFirstAppWindow();
|
||||
EXPECT_TRUE(app_window->is_hidden());
|
||||
ExtensionTestMessageListener create_listener_2("Launched", false);
|
||||
ExtensionTestMessageListener create_listener_2("Launched");
|
||||
create_listener_1.Reply("createHidden");
|
||||
EXPECT_TRUE(create_listener_2.WaitUntilSatisfied());
|
||||
EXPECT_TRUE(app_window->is_hidden());
|
||||
@ -398,15 +406,17 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, TestCreateHidden) {
|
||||
|
||||
// Created hidden, then visible. The second create should show the window.
|
||||
{
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
LoadAndLaunchPlatformApp("hidden_with_id", &launched_listener);
|
||||
EXPECT_TRUE(launched_listener.WaitUntilSatisfied());
|
||||
ExtensionTestMessageListener create_listener_1("Launched", true);
|
||||
ExtensionTestMessageListener create_listener_1("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
launched_listener.Reply("createHidden");
|
||||
EXPECT_TRUE(create_listener_1.WaitUntilSatisfied());
|
||||
AppWindow* app_window = GetFirstAppWindow();
|
||||
EXPECT_TRUE(app_window->is_hidden());
|
||||
ExtensionTestMessageListener create_listener_2("Launched", false);
|
||||
ExtensionTestMessageListener create_listener_2("Launched");
|
||||
create_listener_1.Reply("createVisible");
|
||||
EXPECT_TRUE(create_listener_2.WaitUntilSatisfied());
|
||||
EXPECT_FALSE(app_window->is_hidden());
|
||||
@ -480,7 +490,8 @@ IN_PROC_BROWSER_TEST_F(AppWindowHiddenKeepAliveTest, StaysHidden) {
|
||||
// A window that is created hidden but shown soon after should keep Chrome
|
||||
// alive.
|
||||
IN_PROC_BROWSER_TEST_F(AppWindowHiddenKeepAliveTest, HiddenThenShown) {
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
LoadAndLaunchPlatformApp("hidden_then_shown", &launched_listener);
|
||||
AppWindow* app_window = GetFirstAppWindow();
|
||||
EXPECT_TRUE(app_window->is_hidden());
|
||||
@ -490,7 +501,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowHiddenKeepAliveTest, HiddenThenShown) {
|
||||
browser->window()->Close();
|
||||
|
||||
// The app window will show after 3 seconds.
|
||||
ExtensionTestMessageListener shown_listener("Shown", false);
|
||||
ExtensionTestMessageListener shown_listener("Shown");
|
||||
launched_listener.Reply("");
|
||||
EXPECT_TRUE(shown_listener.WaitUntilSatisfied());
|
||||
EXPECT_FALSE(app_window->is_hidden());
|
||||
|
@ -24,7 +24,8 @@ void FullscreenChangeWaiter::Wait() {
|
||||
|
||||
bool AppWindowInteractiveTest::RunAppWindowInteractiveTest(
|
||||
const char* testName) {
|
||||
ExtensionTestMessageListener launched_listener("Launched", true);
|
||||
ExtensionTestMessageListener launched_listener("Launched",
|
||||
ReplyBehavior::kWillReply);
|
||||
LoadAndLaunchPlatformApp("window_api_interactive", &launched_listener);
|
||||
|
||||
extensions::ResultCatcher catcher;
|
||||
@ -44,7 +45,7 @@ bool AppWindowInteractiveTest::SimulateKeyPress(ui::KeyboardCode key) {
|
||||
}
|
||||
|
||||
void AppWindowInteractiveTest::WaitUntilKeyFocus() {
|
||||
ExtensionTestMessageListener key_listener("KeyReceived", false);
|
||||
ExtensionTestMessageListener key_listener("KeyReceived");
|
||||
|
||||
while (!key_listener.was_satisfied()) {
|
||||
ASSERT_TRUE(SimulateKeyPress(ui::VKEY_Z));
|
||||
|
@ -33,7 +33,7 @@ IN_PROC_BROWSER_TEST_F(AudioFocusWebContentsObserverBrowserTest,
|
||||
PlatformAppHasDifferentAudioFocus) {
|
||||
ASSERT_TRUE(embedded_test_server()->Start());
|
||||
|
||||
ExtensionTestMessageListener launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener launched_listener("Launched");
|
||||
const extensions::Extension* extension =
|
||||
InstallAndLaunchPlatformApp("minimal");
|
||||
ASSERT_TRUE(extension);
|
||||
@ -49,7 +49,7 @@ IN_PROC_BROWSER_TEST_F(AudioFocusWebContentsObserverBrowserTest,
|
||||
EXPECT_NE(base::UnguessableToken::Null(), GetAudioFocusGroupId(web_contents));
|
||||
|
||||
// Create a new window and navigate it to the test app.
|
||||
ExtensionTestMessageListener new_launched_listener("Launched", false);
|
||||
ExtensionTestMessageListener new_launched_listener("Launched");
|
||||
LaunchPlatformApp(extension);
|
||||
ASSERT_TRUE(new_launched_listener.WaitUntilSatisfied());
|
||||
|
||||
|
@ -134,7 +134,7 @@ void PlatformAppNavigationRedirectorBrowserTest::TestNavigationInTab(
|
||||
|
||||
InstallPlatformApp(handler);
|
||||
|
||||
ExtensionTestMessageListener handler_listener(handler_start_message, false);
|
||||
ExtensionTestMessageListener handler_listener(handler_start_message);
|
||||
|
||||
ASSERT_TRUE(ui_test_utils::NavigateToURL(
|
||||
browser(), embedded_test_server()->GetURL(base::StringPrintf(
|
||||
@ -201,7 +201,7 @@ void PlatformAppNavigationRedirectorBrowserTest::TestNavigationInApp(
|
||||
|
||||
InstallPlatformApp(handler);
|
||||
|
||||
ExtensionTestMessageListener handler_listener(handler_start_message, false);
|
||||
ExtensionTestMessageListener handler_listener(handler_start_message);
|
||||
|
||||
LoadAndLaunchPlatformApp(launcher, launcher_done_message);
|
||||
|
||||
@ -254,7 +254,7 @@ void PlatformAppNavigationRedirectorBrowserTest::TestNavigationInBrowser(
|
||||
|
||||
InstallPlatformApp(handler);
|
||||
|
||||
ExtensionTestMessageListener handler_listener(handler_start_message, false);
|
||||
ExtensionTestMessageListener handler_listener(handler_start_message);
|
||||
|
||||
NavigateParams params(
|
||||
browser(),
|
||||
|
Reference in New Issue
Block a user