summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-17 09:41:27 +0000
committerbenwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-17 09:41:27 +0000
commit599f982a262960408e6a6485be64156dfd0b3240 (patch)
treea1d740a5cf667adce65ee5a7faebbb46188e48aa
parentffc5f68f914366f3d4b4c0d109d35bb03da3b05c (diff)
downloadchromium_src-599f982a262960408e6a6485be64156dfd0b3240.zip
chromium_src-599f982a262960408e6a6485be64156dfd0b3240.tar.gz
chromium_src-599f982a262960408e6a6485be64156dfd0b3240.tar.bz2
Make LoadAndLaunchPlatformApp harder to make flaky tests with.
LoadAndLaunchPlatformApp will send a launched event to the app it is launching, which will often end up with windows being opened. If the test does not wait for the window to stop opening, the test will be flaky. This change updates LoadAndLaunchPlatformApp to wait for a signal to come back from the app after it is launched before returning. TBR=sky BUG=383260 Review URL: https://codereview.chromium.org/324333002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277688 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--apps/app_restore_service_browsertest.cc13
-rw-r--r--chrome/browser/apps/app_browsertest.cc83
-rw-r--r--chrome/browser/apps/app_browsertest_util.cc24
-rw-r--r--chrome/browser/apps/app_browsertest_util.h12
-rw-r--r--chrome/browser/apps/app_crash_browsertest.cc8
-rw-r--r--chrome/browser/apps/app_pointer_lock_interactive_uitest.cc6
-rw-r--r--chrome/browser/apps/app_url_redirector_browsertest.cc15
-rw-r--r--chrome/browser/apps/app_window_browsertest.cc2
-rw-r--r--chrome/browser/apps/app_window_interactive_uitest.cc21
-rw-r--r--chrome/browser/apps/ephemeral_app_browsertest.cc5
-rw-r--r--chrome/browser/apps/event_page_browsertest.cc4
-rw-r--r--chrome/browser/apps/web_view_browsertest.cc57
-rw-r--r--chrome/browser/apps/web_view_interactive_browsertest.cc31
-rw-r--r--chrome/browser/apps/window_controls_browsertest.cc4
-rw-r--r--chrome/browser/extensions/api/app_window/app_window_apitest.cc5
-rw-r--r--chrome/browser/ui/ash/accelerator_commands_browsertest.cc3
-rw-r--r--chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc45
-rw-r--r--chrome/test/data/extensions/platform_apps/ephemeral_apps/messaging_sender_fail/main.js1
-rw-r--r--chrome/test/data/extensions/platform_apps/ephemeral_apps/messaging_sender_success/main.js1
-rw-r--r--chrome/test/data/extensions/platform_apps/launch/test.js1
-rw-r--r--chrome/test/data/extensions/platform_apps/launch_2/test.js1
-rw-r--r--chrome/test/data/extensions/platform_apps/messaging/app1/background.js2
-rw-r--r--chrome/test/data/extensions/platform_apps/messaging/app2/background.js2
-rw-r--r--chrome/test/data/extensions/platform_apps/open_link/main.js2
-rw-r--r--chrome/test/data/extensions/platform_apps/web_view/isolation/main.js3
25 files changed, 128 insertions, 223 deletions
diff --git a/apps/app_restore_service_browsertest.cc b/apps/app_restore_service_browsertest.cc
index 1ba87e3..f66b1be 100644
--- a/apps/app_restore_service_browsertest.cc
+++ b/apps/app_restore_service_browsertest.cc
@@ -125,14 +125,9 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAccessIsSavedToPrefs) {
FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest(
"temp", temp_directory.path());
- ExtensionTestMessageListener file_written_listener("fileWritten", false);
- ExtensionTestMessageListener access_ok_listener(
- "restartedFileAccessOK", false);
-
- const Extension* extension =
- LoadAndLaunchPlatformApp("file_access_saved_to_prefs_test");
+ const Extension* extension = LoadAndLaunchPlatformApp(
+ "file_access_saved_to_prefs_test", "fileWritten");
ASSERT_TRUE(extension);
- file_written_listener.WaitUntilSatisfied();
SavedFilesService* saved_files_service = SavedFilesService::Get(profile());
@@ -170,14 +165,12 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_FileAccessIsRestored) {
FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest(
"temp", temp_directory.path());
- ExtensionTestMessageListener file_written_listener("fileWritten", false);
ExtensionTestMessageListener access_ok_listener(
"restartedFileAccessOK", false);
const Extension* extension =
- LoadAndLaunchPlatformApp("file_access_restored_test");
+ LoadAndLaunchPlatformApp("file_access_restored_test", "fileWritten");
ASSERT_TRUE(extension);
- file_written_listener.WaitUntilSatisfied();
ExtensionPrefs* extension_prefs =
ExtensionPrefs::Get(browser()->profile());
diff --git a/chrome/browser/apps/app_browsertest.cc b/chrome/browser/apps/app_browsertest.cc
index 47b851fd..7e6ffe4 100644
--- a/chrome/browser/apps/app_browsertest.cc
+++ b/chrome/browser/apps/app_browsertest.cc
@@ -199,7 +199,7 @@ const char kTestFilePath[] = "platform_apps/launch_files/test.txt";
// LauncherPlatformAppBrowserTest relies on this behaviour, but is only run for
// ash, so we test that it works here.
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, CreateAndCloseAppWindow) {
- const Extension* extension = LoadAndLaunchPlatformApp("minimal");
+ const Extension* extension = LoadAndLaunchPlatformApp("minimal", "Launched");
AppWindow* window = CreateAppWindow(extension);
CloseAppWindow(window);
}
@@ -217,10 +217,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisabledWindowProperties) {
}
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, EmptyContextMenu) {
- ExtensionTestMessageListener launched_listener("Launched", false);
- LoadAndLaunchPlatformApp("minimal");
-
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("minimal", "Launched");
// The empty app doesn't add any context menu items, so its menu should
// only include the developer tools.
@@ -239,12 +236,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, EmptyContextMenu) {
}
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenu) {
- ExtensionTestMessageListener launched_listener("Launched", false);
- LoadAndLaunchPlatformApp("context_menu");
-
- // Wait for the extension to tell us it's initialized its context menus and
- // launched a window.
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("context_menu", "Launched");
// The context_menu app has two context menu items. These, along with a
// separator and the developer tools, is all that should be in the menu.
@@ -293,12 +285,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, InstalledAppWithContextMenu) {
}
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuTextField) {
- ExtensionTestMessageListener launched_listener("Launched", false);
- LoadAndLaunchPlatformApp("context_menu");
-
- // Wait for the extension to tell us it's initialized its context menus and
- // launched a window.
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("context_menu", "Launched");
// The context_menu app has one context menu item. This, along with a
// separator and the developer tools, is all that should be in the menu.
@@ -321,12 +308,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuTextField) {
}
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuSelection) {
- ExtensionTestMessageListener launched_listener("Launched", false);
- LoadAndLaunchPlatformApp("context_menu");
-
- // Wait for the extension to tell us it's initialized its context menus and
- // launched a window.
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("context_menu", "Launched");
// The context_menu app has one context menu item. This, along with a
// separator and the developer tools, is all that should be in the menu.
@@ -349,12 +331,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuSelection) {
}
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuClicked) {
- ExtensionTestMessageListener launched_listener("Launched", false);
- LoadAndLaunchPlatformApp("context_menu_click");
-
- // Wait for the extension to tell us it's initialized its context menus and
- // launched a window.
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("context_menu_click", "Launched");
// Test that the menu item shows up
WebContents* web_contents = GetFirstAppWindowWebContents();
@@ -470,9 +447,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_ExtensionWindowingApis) {
ASSERT_EQ(0U, GetAppWindowCount());
// Launch a platform app that shows a window.
- ExtensionTestMessageListener launched_listener("Launched", false);
- LoadAndLaunchPlatformApp("minimal");
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("minimal", "Launched");
ASSERT_EQ(1U, GetAppWindowCount());
int app_window_id = GetFirstAppWindow()->session_id().id();
@@ -487,9 +462,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_ExtensionWindowingApis) {
// to get a list of all the app windows, so we can test this.
// Launch another platform app that also shows a window.
- ExtensionTestMessageListener launched_listener2("Launched", false);
- LoadAndLaunchPlatformApp("context_menu");
- ASSERT_TRUE(launched_listener2.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("context_menu", "Launched");
// There are two total app windows, but each app can only see its own.
ASSERT_EQ(2U, GetAppWindowCount());
@@ -726,7 +699,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenLink) {
content::WindowedNotificationObserver observer(
chrome::NOTIFICATION_TAB_ADDED,
content::Source<content::WebContentsDelegate>(browser()));
- LoadAndLaunchPlatformApp("open_link");
+ LoadAndLaunchPlatformApp("open_link", "Launched");
observer.Wait();
ASSERT_EQ(2, browser()->tab_strip_model()->count());
}
@@ -748,10 +721,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_AppWindowRestoreState) {
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
AppWindowAdjustBoundsToBeVisibleOnScreen) {
- ExtensionTestMessageListener launched_listener("Launched", false);
-
- const Extension* extension = LoadAndLaunchPlatformApp("minimal");
- EXPECT_TRUE(launched_listener.WaitUntilSatisfied());
+ const Extension* extension = LoadAndLaunchPlatformApp("minimal", "Launched");
AppWindow* window = CreateAppWindow(extension);
@@ -839,10 +809,8 @@ class PlatformAppDevToolsBrowserTest : public PlatformAppBrowserTest {
void PlatformAppDevToolsBrowserTest::RunTestWithDevTools(
const char* name, int test_flags) {
using content::DevToolsAgentHost;
- ExtensionTestMessageListener launched_listener("Launched", false);
- const Extension* extension = LoadAndLaunchPlatformApp(name);
+ const Extension* extension = LoadAndLaunchPlatformApp(name, "Launched");
ASSERT_TRUE(extension);
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
AppWindow* window = GetFirstAppWindow();
ASSERT_TRUE(window);
ASSERT_EQ(window->window_key().empty(), (test_flags & HAS_ID) == 0);
@@ -916,7 +884,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppDevToolsBrowserTest, MAYBE_ReOpenedWithURL) {
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_ConstrainedWindowRequest) {
PermissionsRequestFunction::SetIgnoreUserGestureForTests(true);
const Extension* extension =
- LoadAndLaunchPlatformApp("optional_permission_request");
+ LoadAndLaunchPlatformApp("optional_permission_request", "Launched");
ASSERT_TRUE(extension) << "Failed to load extension.";
WebContents* web_contents = GetFirstAppWindowWebContents();
@@ -940,9 +908,9 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_ConstrainedWindowRequest) {
// relaunch it if it was running.
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ReloadRelaunches) {
ExtensionTestMessageListener launched_listener("Launched", true);
- const Extension* extension = LoadAndLaunchPlatformApp("reload");
+ const Extension* extension =
+ LoadAndLaunchPlatformApp("reload", &launched_listener);
ASSERT_TRUE(extension);
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
ASSERT_TRUE(GetFirstAppWindow());
// Now tell the app to reload itself
@@ -1081,8 +1049,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ComponentAppBackgroundPage) {
#endif
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_Messaging) {
ExtensionApiTest::ResultCatcher result_catcher;
- LoadAndLaunchPlatformApp("messaging/app2");
- LoadAndLaunchPlatformApp("messaging/app1");
+ LoadAndLaunchPlatformApp("messaging/app2", "Launched");
+ LoadAndLaunchPlatformApp("messaging/app1", "Launched");
EXPECT_TRUE(result_catcher.GetNextResult());
}
@@ -1095,9 +1063,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_Messaging) {
#define MAYBE_WebContentsHasFocus DISABLED_WebContentsHasFocus
#endif
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WebContentsHasFocus) {
- ExtensionTestMessageListener launched_listener("Launched", true);
- LoadAndLaunchPlatformApp("minimal");
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("minimal", "Launched");
EXPECT_EQ(1LU, GetAppWindowCount());
EXPECT_TRUE(GetFirstAppWindow()
@@ -1273,9 +1239,9 @@ IN_PROC_BROWSER_TEST_F(RestartDeviceTest, Restart) {
ASSERT_EQ(0, num_request_restart_calls());
ExtensionTestMessageListener launched_listener("Launched", true);
- const Extension* extension = LoadAndLaunchPlatformApp("restart_device");
+ const Extension* extension = LoadAndLaunchPlatformApp("restart_device",
+ &launched_listener);
ASSERT_TRUE(extension);
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
launched_listener.Reply("restart");
ExtensionTestMessageListener restart_requested_listener("restartRequested",
@@ -1297,15 +1263,12 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ReinstallDataCleanup) {
std::string extension_id;
{
- ExtensionTestMessageListener launched_listener("Launched", false);
const Extension* extension =
- LoadAndLaunchPlatformApp("reinstall_data_cleanup");
+ LoadAndLaunchPlatformApp("reinstall_data_cleanup", "Launched");
ASSERT_TRUE(extension);
extension_id = extension->id();
ExtensionApiTest::ResultCatcher result_catcher;
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
-
EXPECT_TRUE(result_catcher.GetNextResult());
}
@@ -1313,16 +1276,12 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ReinstallDataCleanup) {
content::RunAllPendingInMessageLoop();
{
- ExtensionTestMessageListener launched_listener("Launched", false);
const Extension* extension =
- LoadAndLaunchPlatformApp("reinstall_data_cleanup");
+ LoadAndLaunchPlatformApp("reinstall_data_cleanup", "Launched");
ASSERT_TRUE(extension);
ASSERT_EQ(extension_id, extension->id());
ExtensionApiTest::ResultCatcher result_catcher;
-
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
-
EXPECT_TRUE(result_catcher.GetNextResult());
}
}
diff --git a/chrome/browser/apps/app_browsertest_util.cc b/chrome/browser/apps/app_browsertest_util.cc
index 2290617..3bcd074 100644
--- a/chrome/browser/apps/app_browsertest_util.cc
+++ b/chrome/browser/apps/app_browsertest_util.cc
@@ -62,18 +62,27 @@ AppWindow* PlatformAppBrowserTest::GetFirstAppWindowForBrowser(
}
const Extension* PlatformAppBrowserTest::LoadAndLaunchPlatformApp(
- const char* name) {
- content::WindowedNotificationObserver app_loaded_observer(
- content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
- content::NotificationService::AllSources());
-
+ const char* name,
+ ExtensionTestMessageListener* listener) {
+ DCHECK(listener);
const Extension* extension = LoadExtension(
test_data_dir_.AppendASCII("platform_apps").AppendASCII(name));
EXPECT_TRUE(extension);
LaunchPlatformApp(extension);
- app_loaded_observer.Wait();
+ EXPECT_TRUE(listener->WaitUntilSatisfied()) << "'" << listener->message()
+ << "' message was not receieved";
+
+ return extension;
+}
+
+const Extension* PlatformAppBrowserTest::LoadAndLaunchPlatformApp(
+ const char* name,
+ const std::string& message) {
+ ExtensionTestMessageListener launched_listener(message, false);
+ const Extension* extension =
+ LoadAndLaunchPlatformApp(name, &launched_listener);
return extension;
}
@@ -226,7 +235,8 @@ apps::AppWindow* PlatformAppBrowserTest::CreateTestAppWindow(
ExtensionTestMessageListener loaded_listener("window_loaded", false);
// Load and launch the test app.
- const Extension* extension = LoadAndLaunchPlatformApp(kAppWindowTestApp);
+ const Extension* extension =
+ LoadAndLaunchPlatformApp(kAppWindowTestApp, &launched_listener);
EXPECT_TRUE(extension);
EXPECT_TRUE(launched_listener.WaitUntilSatisfied());
diff --git a/chrome/browser/apps/app_browsertest_util.h b/chrome/browser/apps/app_browsertest_util.h
index 6dc8da8..6de5ecc 100644
--- a/chrome/browser/apps/app_browsertest_util.h
+++ b/chrome/browser/apps/app_browsertest_util.h
@@ -18,6 +18,7 @@ class WebContents;
}
class Browser;
+class ExtensionTestMessageListener;
namespace extensions {
class Extension;
@@ -33,8 +34,15 @@ class PlatformAppBrowserTest : public ExtensionApiTest {
protected:
// Runs the app named |name| out of the platform_apps subdirectory. Waits
- // until it is launched.
- const Extension* LoadAndLaunchPlatformApp(const char* name);
+ // for the provided listener to be satisifed.
+ const Extension* LoadAndLaunchPlatformApp(
+ const char* name,
+ ExtensionTestMessageListener* listener);
+
+ // Runs the app named |name| out of the platform_apps subdirectory. Waits
+ // until the given message is received from the app.
+ const Extension* LoadAndLaunchPlatformApp(const char* name,
+ const std::string& message);
// Installs the app named |name| out of the platform_apps subdirectory.
const Extension* InstallPlatformApp(const char* name);
diff --git a/chrome/browser/apps/app_crash_browsertest.cc b/chrome/browser/apps/app_crash_browsertest.cc
index b03d120..d35e106 100644
--- a/chrome/browser/apps/app_crash_browsertest.cc
+++ b/chrome/browser/apps/app_crash_browsertest.cc
@@ -18,13 +18,11 @@
class AppCrashTest : public extensions::PlatformAppBrowserTest {
public:
- bool RunAppCrashTest(const char* name) {
- ExtensionTestMessageListener listener("Done", false);
- LoadAndLaunchPlatformApp(name);
- return listener.WaitUntilSatisfied();
+ void RunAppCrashTest(const char* name) {
+ LoadAndLaunchPlatformApp(name, "Done");
}
};
IN_PROC_BROWSER_TEST_F(AppCrashTest, HiddenWindows) {
- ASSERT_TRUE(RunAppCrashTest("crashtest_hidden_windows"));
+ RunAppCrashTest("crashtest_hidden_windows");
}
diff --git a/chrome/browser/apps/app_pointer_lock_interactive_uitest.cc b/chrome/browser/apps/app_pointer_lock_interactive_uitest.cc
index 401b738..b514cc5 100644
--- a/chrome/browser/apps/app_pointer_lock_interactive_uitest.cc
+++ b/chrome/browser/apps/app_pointer_lock_interactive_uitest.cc
@@ -11,11 +11,7 @@ class ExtensionPointerLockTest : public extensions::PlatformAppBrowserTest {
public:
bool RunExtensionPointerLockTest(const char* app_path) {
ExtensionTestMessageListener launched_listener("Launched", true);
- LoadAndLaunchPlatformApp(app_path);
- if (!launched_listener.WaitUntilSatisfied()) {
- message_ = "Did not get the 'Launched' message.";
- return false;
- }
+ LoadAndLaunchPlatformApp(app_path, &launched_listener);
ResultCatcher catcher;
diff --git a/chrome/browser/apps/app_url_redirector_browsertest.cc b/chrome/browser/apps/app_url_redirector_browsertest.cc
index 4bcb326..865087c5 100644
--- a/chrome/browser/apps/app_url_redirector_browsertest.cc
+++ b/chrome/browser/apps/app_url_redirector_browsertest.cc
@@ -211,12 +211,10 @@ void PlatformAppUrlRedirectorBrowserTest::TestNavigationInApp(
InstallPlatformApp(handler);
- ExtensionTestMessageListener launcher_listener(launcher_done_message, false);
ExtensionTestMessageListener handler_listener(handler_start_message, false);
- LoadAndLaunchPlatformApp(launcher);
+ LoadAndLaunchPlatformApp(launcher, launcher_done_message);
- ASSERT_TRUE(launcher_listener.WaitUntilSatisfied());
ASSERT_TRUE(handler_listener.WaitUntilSatisfied());
ASSERT_EQ(2U, GetAppWindowCount());
@@ -234,11 +232,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestNegativeNavigationInApp(
chrome::NOTIFICATION_TAB_ADDED,
content::Source<content::WebContentsDelegate>(browser()));
- ExtensionTestMessageListener launcher_done_listener(launcher_done_message,
- false);
- LoadAndLaunchPlatformApp(launcher);
-
- ASSERT_TRUE(launcher_done_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp(launcher, launcher_done_message);
observer.Wait();
@@ -257,10 +251,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestMismatchingNavigationInApp(
chrome::NOTIFICATION_TAB_ADDED,
content::Source<content::WebContentsDelegate>(browser()));
- ExtensionTestMessageListener launcher_listener(launcher_done_message, false);
- LoadAndLaunchPlatformApp(launcher);
-
- ASSERT_TRUE(launcher_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp(launcher, launcher_done_message);
observer.Wait();
ASSERT_EQ(1U, GetAppWindowCount());
diff --git a/chrome/browser/apps/app_window_browsertest.cc b/chrome/browser/apps/app_window_browsertest.cc
index 0272567..2a0ad43 100644
--- a/chrome/browser/apps/app_window_browsertest.cc
+++ b/chrome/browser/apps/app_window_browsertest.cc
@@ -112,7 +112,7 @@ class AppWindowAPITest : public extensions::PlatformAppBrowserTest {
private:
bool BeginAppWindowAPITest(const char* testName) {
ExtensionTestMessageListener launched_listener("Launched", true);
- LoadAndLaunchPlatformApp("window_api");
+ LoadAndLaunchPlatformApp("window_api", &launched_listener);
if (!launched_listener.WaitUntilSatisfied()) {
message_ = "Did not get the 'Launched' message.";
return false;
diff --git a/chrome/browser/apps/app_window_interactive_uitest.cc b/chrome/browser/apps/app_window_interactive_uitest.cc
index 0c90e44..c7bfa91 100644
--- a/chrome/browser/apps/app_window_interactive_uitest.cc
+++ b/chrome/browser/apps/app_window_interactive_uitest.cc
@@ -37,11 +37,7 @@ class AppWindowInteractiveTest : public extensions::PlatformAppBrowserTest {
public:
bool RunAppWindowInteractiveTest(const char* testName) {
ExtensionTestMessageListener launched_listener("Launched", true);
- LoadAndLaunchPlatformApp("window_api_interactive");
- if (!launched_listener.WaitUntilSatisfied()) {
- message_ = "Did not get the 'Launched' message.";
- return false;
- }
+ LoadAndLaunchPlatformApp("window_api_interactive", &launched_listener);
ResultCatcher catcher;
launched_listener.Reply(testName);
@@ -83,8 +79,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenWindow) {
#endif
ExtensionTestMessageListener launched_listener("Launched", true);
- LoadAndLaunchPlatformApp("leave_fullscreen");
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("leave_fullscreen", &launched_listener);
// We start by making sure the window is actually focused.
ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(
@@ -127,8 +122,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenDOM) {
#endif
ExtensionTestMessageListener launched_listener("Launched", true);
- LoadAndLaunchPlatformApp("leave_fullscreen");
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("leave_fullscreen", &launched_listener);
// We start by making sure the window is actually focused.
ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(
@@ -179,8 +173,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
#endif
ExtensionTestMessageListener launched_listener("Launched", true);
- LoadAndLaunchPlatformApp("prevent_leave_fullscreen");
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("prevent_leave_fullscreen", &launched_listener);
// We start by making sure the window is actually focused.
ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(
@@ -228,8 +221,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
#endif
ExtensionTestMessageListener launched_listener("Launched", true);
- LoadAndLaunchPlatformApp("prevent_leave_fullscreen");
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("prevent_leave_fullscreen", &launched_listener);
// We start by making sure the window is actually focused.
ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(
@@ -287,8 +279,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
#endif
ExtensionTestMessageListener launched_listener("Launched", true);
- LoadAndLaunchPlatformApp("prevent_leave_fullscreen_old");
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("prevent_leave_fullscreen_old", &launched_listener);
// We start by making sure the window is actually focused.
ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(
diff --git a/chrome/browser/apps/ephemeral_app_browsertest.cc b/chrome/browser/apps/ephemeral_app_browsertest.cc
index 4744e50..ff2f4b7 100644
--- a/chrome/browser/apps/ephemeral_app_browsertest.cc
+++ b/chrome/browser/apps/ephemeral_app_browsertest.cc
@@ -404,13 +404,14 @@ IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, ReceiveMessagesWhenLaunched) {
// Verify that messages are received while the app is running.
ExtensionApiTest::ResultCatcher result_catcher;
- LoadAndLaunchPlatformApp("ephemeral_apps/messaging_sender_success");
+ LoadAndLaunchPlatformApp("ephemeral_apps/messaging_sender_success",
+ "Launched");
EXPECT_TRUE(result_catcher.GetNextResult());
CloseApp(receiver->id());
// Verify that messages are not received while the app is inactive.
- LoadAndLaunchPlatformApp("ephemeral_apps/messaging_sender_fail");
+ LoadAndLaunchPlatformApp("ephemeral_apps/messaging_sender_fail", "Launched");
EXPECT_TRUE(result_catcher.GetNextResult());
}
diff --git a/chrome/browser/apps/event_page_browsertest.cc b/chrome/browser/apps/event_page_browsertest.cc
index 3cbcb77..1da70cb 100644
--- a/chrome/browser/apps/event_page_browsertest.cc
+++ b/chrome/browser/apps/event_page_browsertest.cc
@@ -18,10 +18,8 @@ class AppEventPageTest : public PlatformAppBrowserTest {
protected:
void TestUnloadEventPage(const char* app_path) {
// Load and launch the app.
- ExtensionTestMessageListener launched_listener("launched", false);
- const Extension* extension = LoadAndLaunchPlatformApp(app_path);
+ const Extension* extension = LoadAndLaunchPlatformApp(app_path, "launched");
ASSERT_TRUE(extension);
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
content::WindowedNotificationObserver event_page_suspended(
chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
diff --git a/chrome/browser/apps/web_view_browsertest.cc b/chrome/browser/apps/web_view_browsertest.cc
index 3c9220b..f258b40 100644
--- a/chrome/browser/apps/web_view_browsertest.cc
+++ b/chrome/browser/apps/web_view_browsertest.cc
@@ -399,7 +399,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest {
tag_url6, content::NotificationService::AllSources());
ui_test_utils::UrlLoadObserver observer7(
tag_url7, content::NotificationService::AllSources());
- LoadAndLaunchPlatformApp("web_view/isolation");
+ LoadAndLaunchPlatformApp("web_view/isolation", "Launched");
observer1.Wait();
observer2.Wait();
observer3.Wait();
@@ -571,12 +571,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest {
base::Bind(&WebViewTest::EmptyResponseHandler, kEmptyResponsePath));
}
- ExtensionTestMessageListener launched_listener("Launched", false);
- LoadAndLaunchPlatformApp(app_location.c_str());
- if (!launched_listener.WaitUntilSatisfied()) {
- LOG(ERROR) << "TEST DID NOT LAUNCH.";
- return;
- }
+ LoadAndLaunchPlatformApp(app_location.c_str(), "Launched");
// Flush any pending events to make sure we start with a clean slate.
content::RunAllPendingInMessageLoop();
@@ -611,19 +606,14 @@ class WebViewTest : public extensions::PlatformAppBrowserTest {
ui_test_utils::UrlLoadObserver guest_observer(
guest_url, content::NotificationService::AllSources());
- ExtensionTestMessageListener guest_loaded_listener("guest-loaded", false);
- LoadAndLaunchPlatformApp(app_path.c_str());
- guest_observer.Wait();
+ LoadAndLaunchPlatformApp(app_path.c_str(), "guest-loaded");
+ guest_observer.Wait();
content::Source<content::NavigationController> source =
guest_observer.source();
EXPECT_TRUE(source->GetWebContents()->GetRenderProcessHost()->
IsIsolatedGuest());
- bool satisfied = guest_loaded_listener.WaitUntilSatisfied();
- if (!satisfied)
- return NULL;
-
content::WebContents* guest_web_contents = source->GetWebContents();
return guest_web_contents;
}
@@ -635,9 +625,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest {
// they timeout (mostly on Windows).
void MediaAccessAPIDenyTestHelper(const std::string& test_name) {
ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
- ExtensionTestMessageListener loaded_listener("loaded", false);
- LoadAndLaunchPlatformApp("web_view/media_access/deny");
- ASSERT_TRUE(loaded_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("web_view/media_access/deny", "loaded");
content::WebContents* embedder_web_contents =
GetFirstAppWindowWebContents();
@@ -670,8 +658,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest {
ExtensionTestMessageListener launched_listener("WebViewTest.LAUNCHED",
false);
launched_listener.set_failure_message("WebViewTest.FAILURE");
- LoadAndLaunchPlatformApp(app_path.c_str());
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp(app_path.c_str(), &launched_listener);
guest_web_contents_ = new_client.WaitForGuestCreated();
SetBrowserClientForTesting(old_client);
@@ -1102,9 +1089,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveWebviewOnExit) {
ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
// Launch the app and wait until it's ready to load a test.
- ExtensionTestMessageListener launched_listener("Launched", false);
- LoadAndLaunchPlatformApp("web_view/shim");
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("web_view/shim", "Launched");
content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents();
ASSERT_TRUE(embedder_web_contents);
@@ -1194,10 +1179,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_InterstitialTeardown) {
net::HostPortPair host_and_port = https_server.host_port_pair();
- ExtensionTestMessageListener embedder_loaded_listener("EmbedderLoaded",
- false);
- LoadAndLaunchPlatformApp("web_view/interstitial_teardown");
- ASSERT_TRUE(embedder_loaded_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("web_view/interstitial_teardown", "EmbedderLoaded");
GuestContentBrowserClient new_client;
content::ContentBrowserClient* old_client =
@@ -1703,10 +1685,8 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_IndexedDBIsolation) {
#define MAYBE_CloseOnLoadcommit CloseOnLoadcommit
#endif
IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_CloseOnLoadcommit) {
- ExtensionTestMessageListener done_test_listener(
- "done-close-on-loadcommit", false);
- LoadAndLaunchPlatformApp("web_view/close_on_loadcommit");
- ASSERT_TRUE(done_test_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("web_view/close_on_loadcommit",
+ "done-close-on-loadcommit");
}
IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIDeny_TestDeny) {
@@ -1736,9 +1716,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest,
void WebViewTest::MediaAccessAPIAllowTestHelper(const std::string& test_name) {
ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
- ExtensionTestMessageListener launched_listener("Launched", false);
- LoadAndLaunchPlatformApp("web_view/media_access/allow");
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("web_view/media_access/allow", "Launched");
content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents();
ASSERT_TRUE(embedder_web_contents);
@@ -1861,10 +1839,8 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, ChromeVoxInjection) {
#define MAYBE_TearDownTest TearDownTest
#endif
IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_TearDownTest) {
- ExtensionTestMessageListener first_loaded_listener("guest-loaded", false);
const extensions::Extension* extension =
- LoadAndLaunchPlatformApp("web_view/teardown");
- ASSERT_TRUE(first_loaded_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("web_view/teardown", "guest-loaded");
apps::AppWindow* window = NULL;
if (!GetAppWindowCount())
window = CreateAppWindow(extension);
@@ -1873,9 +1849,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_TearDownTest) {
CloseAppWindow(window);
// Load the app again.
- ExtensionTestMessageListener second_loaded_listener("guest-loaded", false);
- LoadAndLaunchPlatformApp("web_view/teardown");
- ASSERT_TRUE(second_loaded_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("web_view/teardown", "guest-loaded");
}
// In following GeolocationAPIEmbedderHasNoAccess* tests, embedder (i.e. the
@@ -2053,9 +2027,8 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, WhitelistedContentScript) {
ASSERT_EQ(extension_id, content_script_whitelisted_extension->id());
// Now load an app with <webview>.
- ExtensionTestMessageListener done_listener("TEST_PASSED", false);
- LoadAndLaunchPlatformApp("web_view/content_script_whitelisted");
- ASSERT_TRUE(done_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("web_view/content_script_whitelisted",
+ "TEST_PASSED");
}
IN_PROC_BROWSER_TEST_F(WebViewTest, SetPropertyOnDocumentReady) {
diff --git a/chrome/browser/apps/web_view_interactive_browsertest.cc b/chrome/browser/apps/web_view_interactive_browsertest.cc
index 6833b9b..8543024 100644
--- a/chrome/browser/apps/web_view_interactive_browsertest.cc
+++ b/chrome/browser/apps/web_view_interactive_browsertest.cc
@@ -159,13 +159,7 @@ class WebViewInteractiveTest
return scoped_ptr<ExtensionTestMessageListener>();
}
- ExtensionTestMessageListener launched_listener("Launched", false);
- LoadAndLaunchPlatformApp(app_location.c_str());
- if (!launched_listener.WaitUntilSatisfied()) {
- LOG(ERROR) << "TEST DID NOT LAUNCH.";
- return scoped_ptr<ExtensionTestMessageListener>();
- }
-
+ LoadAndLaunchPlatformApp(app_location.c_str(), "Launched");
if (!ui_test_utils::ShowAndFocusNativeWindow(GetPlatformAppWindow())) {
LOG(ERROR) << "UNABLE TO FOCUS TEST WINDOW.";
return scoped_ptr<ExtensionTestMessageListener>();
@@ -225,14 +219,9 @@ class WebViewInteractiveTest
ui_test_utils::UrlLoadObserver guest_observer(
guest_url, content::NotificationService::AllSources());
- ExtensionTestMessageListener guest_connected_listener("connected", false);
- LoadAndLaunchPlatformApp(app_name.c_str());
+ LoadAndLaunchPlatformApp(app_name.c_str(), "connected");
guest_observer.Wait();
-
- // Wait until the guest process reports that it has established a message
- // channel with the app.
- ASSERT_TRUE(guest_connected_listener.WaitUntilSatisfied());
content::Source<content::NavigationController> source =
guest_observer.source();
EXPECT_TRUE(source->GetWebContents()->GetRenderProcessHost()->
@@ -663,11 +652,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, Focus_BlurEvent) {
// Tests that guests receive edit commands and respond appropriately.
IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, EditCommands) {
- ExtensionTestMessageListener guest_connected_listener("connected", false);
- LoadAndLaunchPlatformApp("web_view/edit_commands");
- // Wait until the guest process reports that it has established a message
- // channel with the app.
- ASSERT_TRUE(guest_connected_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("web_view/edit_commands", "connected");
ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(
GetPlatformAppWindow()));
@@ -821,10 +806,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, PopupPositioningMoved) {
// of simulating mouse drag code's dependency on platforms.
#if defined(OS_CHROMEOS)
IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, DragDropWithinWebView) {
- ExtensionTestMessageListener guest_connected_listener("connected", false);
- LoadAndLaunchPlatformApp("web_view/dnd_within_webview");
- ASSERT_TRUE(guest_connected_listener.WaitUntilSatisfied());
-
+ LoadAndLaunchPlatformApp("web_view/dnd_within_webview", "connected");
ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(GetPlatformAppWindow()));
embedder_web_contents_ = GetFirstAppWindowWebContents();
@@ -867,10 +849,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, Navigation) {
}
IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, Navigation_BackForwardKeys) {
- ExtensionTestMessageListener launched_listener("Launched", false);
- LoadAndLaunchPlatformApp("web_view/navigation");
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
-
+ LoadAndLaunchPlatformApp("web_view/navigation", "Launched");
ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(
GetPlatformAppWindow()));
// Flush any pending events to make sure we start with a clean slate.
diff --git a/chrome/browser/apps/window_controls_browsertest.cc b/chrome/browser/apps/window_controls_browsertest.cc
index 172aa32..c88ec8c 100644
--- a/chrome/browser/apps/window_controls_browsertest.cc
+++ b/chrome/browser/apps/window_controls_browsertest.cc
@@ -52,10 +52,8 @@ content::WebContents* WindowControlsTest::GetWebContentsForExtensionWindow(
IN_PROC_BROWSER_TEST_F(WindowControlsTest, CloseControlWorks) {
// Launch app and wait for window to show up
- ExtensionTestMessageListener window_opened("window-opened", false);
const extensions::Extension* extension =
- LoadAndLaunchPlatformApp("window_controls/buttons");
- ASSERT_TRUE(window_opened.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("window_controls/buttons", "window-opened");
// Find WebContents of window
content::WebContents* web_contents =
diff --git a/chrome/browser/extensions/api/app_window/app_window_apitest.cc b/chrome/browser/extensions/api/app_window/app_window_apitest.cc
index 8b581579..5b20a42 100644
--- a/chrome/browser/extensions/api/app_window/app_window_apitest.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_apitest.cc
@@ -51,11 +51,8 @@ namespace extensions {
IN_PROC_BROWSER_TEST_F(ExperimentalPlatformAppBrowserTest, WindowsApiSetIcon) {
scoped_ptr<TestAppWindowRegistryObserver> test_observer(
new TestAppWindowRegistryObserver(browser()->profile()));
- ExtensionTestMessageListener listener("IconSet", false);
- LoadAndLaunchPlatformApp("windows_api_set_icon");
+ LoadAndLaunchPlatformApp("windows_api_set_icon", "IconSet");
EXPECT_EQ(0, test_observer->icon_updates());
- // Wait until the icon load has been requested.
- ASSERT_TRUE(listener.WaitUntilSatisfied());
// Now wait until the WebContent has decoded the icon and chrome has
// processed it. This needs to be in a loop since the renderer runs in a
// different process.
diff --git a/chrome/browser/ui/ash/accelerator_commands_browsertest.cc b/chrome/browser/ui/ash/accelerator_commands_browsertest.cc
index 77b1ace..34c64f2 100644
--- a/chrome/browser/ui/ash/accelerator_commands_browsertest.cc
+++ b/chrome/browser/ui/ash/accelerator_commands_browsertest.cc
@@ -271,7 +271,8 @@ IN_PROC_BROWSER_TEST_P(AcceleratorCommandsPlatformAppFullscreenBrowserTest,
#endif
ASSERT_TRUE(ash::Shell::HasInstance()) << "No Instance";
- const extensions::Extension* extension = LoadAndLaunchPlatformApp("minimal");
+ const extensions::Extension* extension = LoadAndLaunchPlatformApp("minimal",
+ "Launched");
{
// Test that ToggleFullscreen() toggles a platform's app's fullscreen
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
index bd0df8c7..38dc463 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -343,7 +343,7 @@ typedef LauncherPlatformAppBrowserTest ShelfAppBrowserMinimizeOnClick;
// Test that we can launch a platform app and get a running item.
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchUnpinned) {
int item_count = shelf_model()->item_count();
- const Extension* extension = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched");
AppWindow* window = CreateAppWindow(extension);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
@@ -360,7 +360,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPinned) {
int item_count = shelf_model()->item_count();
// First get app_id.
- const Extension* extension = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched");
const std::string app_id = extension->id();
// Then create a shortcut.
@@ -390,7 +390,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPinned) {
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, PinRunning) {
// Run.
int item_count = shelf_model()->item_count();
- const Extension* extension = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched");
AppWindow* window = CreateAppWindow(extension);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
@@ -429,7 +429,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, UnpinRunning) {
int item_count = shelf_model()->item_count();
// First get app_id.
- const Extension* extension = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched");
const std::string app_id = extension->id();
// Then create a shortcut.
@@ -477,7 +477,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleWindows) {
int item_count = shelf_model()->item_count();
// First run app.
- const Extension* extension = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched");
AppWindow* window1 = CreateAppWindow(extension);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
@@ -514,7 +514,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleApps) {
int item_count = shelf_model()->item_count();
// First run app.
- const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched");
AppWindow* window1 = CreateAppWindow(extension1);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
@@ -524,7 +524,8 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleApps) {
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
// Then run second app.
- const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2");
+ const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2",
+ "Launched");
AppWindow* window2 = CreateAppWindow(extension2);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
@@ -555,7 +556,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowActivation) {
int item_count = shelf_model()->item_count();
// First run app.
- const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched");
AppWindow* window1 = CreateAppWindow(extension1);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
@@ -565,7 +566,8 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowActivation) {
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
// Then run second app.
- const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2");
+ const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2",
+ "Launched");
AppWindow* window2 = CreateAppWindow(extension2);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
@@ -638,7 +640,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, InstallEphemeralApp) {
// Sanity check to verify that ChromeLauncherController::CanInstall() returns
// false for apps that are fully installed.
- const Extension* app = LoadAndLaunchPlatformApp("launch");
+ const Extension* app = LoadAndLaunchPlatformApp("launch", "Launched");
ASSERT_TRUE(app);
CreateAppWindow(app);
++item_count;
@@ -675,7 +677,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, InstallEphemeralApp) {
// Confirm that Click behavior for app windows is correnct.
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserNoMinimizeOnClick, AppClickBehavior) {
// Launch a platform app and create a window for it.
- const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched");
AppWindow* window1 = CreateAppWindow(extension1);
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
@@ -713,7 +715,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserNoMinimizeOnClick, AppClickBehavior) {
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserMinimizeOnClick,
PackagedAppClickBehaviorInMinimizeMode) {
// Launch one platform app and create a window for it.
- const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched");
AppWindow* window1 = CreateAppWindow(extension1);
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
@@ -773,7 +775,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanelClickBehavior) {
CommandLine::ForCurrentProcess()->AppendSwitch(
extensions::switches::kEnableExperimentalExtensionApis);
// Launch a platform app and create a panel window for it.
- const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched");
AppWindow::CreateParams params;
params.window_type = AppWindow::WINDOW_TYPE_PANEL;
params.focused = false;
@@ -807,7 +809,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) {
int item_count = shelf_model()->item_count();
// First run app.
- const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched");
CreateAppWindow(extension1);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
@@ -829,10 +831,8 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, SetIcon) {
extensions::switches::kEnableExperimentalExtensionApis);
int base_shelf_item_count = shelf_model()->item_count();
- ExtensionTestMessageListener launched_listener("Launched", false);
ExtensionTestMessageListener completed_listener("Completed", false);
- LoadAndLaunchPlatformApp("app_icon");
- ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+ LoadAndLaunchPlatformApp("app_icon", "Launched");
ASSERT_TRUE(completed_listener.WaitUntilSatisfied());
// Now wait until the WebContent has decoded the icons and chrome has
@@ -1370,7 +1370,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, AltNumberTabsTabbing) {
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest,
AltNumberAppsTabbing) {
// First run app.
- const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched");
ui::BaseWindow* window1 = CreateAppWindow(extension1)->GetBaseWindow();
const ash::ShelfItem& item1 = GetLastLauncherItem();
ash::ShelfID app_id = item1.id;
@@ -1379,7 +1379,8 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest,
EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type);
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
- const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2");
+ const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2",
+ "Launched");
ui::BaseWindow* window2 = CreateAppWindow(extension2)->GetBaseWindow();
// By now the browser should be active. Issue Alt keystrokes several times to
@@ -1403,7 +1404,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest,
// Test that we can launch a platform app panel and get a running item.
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPanelWindow) {
int item_count = shelf_model()->item_count();
- const Extension* extension = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched");
AppWindow::CreateParams params;
params.window_type = AppWindow::WINDOW_TYPE_PANEL;
params.focused = false;
@@ -1422,7 +1423,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPanelWindow) {
// Test that we get correct shelf presence with hidden app windows.
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, HiddenAppWindows) {
int item_count = shelf_model()->item_count();
- const Extension* extension = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched");
AppWindow::CreateParams params;
// Create a hidden window.
@@ -1458,7 +1459,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, HiddenAppWindows) {
// Test attention states of windows.
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowAttentionStatus) {
- const Extension* extension = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension = LoadAndLaunchPlatformApp("launch", "Launched");
AppWindow::CreateParams params;
params.window_type = AppWindow::WINDOW_TYPE_PANEL;
params.focused = false;
diff --git a/chrome/test/data/extensions/platform_apps/ephemeral_apps/messaging_sender_fail/main.js b/chrome/test/data/extensions/platform_apps/ephemeral_apps/messaging_sender_fail/main.js
index 0a4e281..19881d1 100644
--- a/chrome/test/data/extensions/platform_apps/ephemeral_apps/messaging_sender_fail/main.js
+++ b/chrome/test/data/extensions/platform_apps/ephemeral_apps/messaging_sender_fail/main.js
@@ -36,6 +36,7 @@ function testConnect() {
}
chrome.app.runtime.onLaunched.addListener(function() {
+ chrome.test.sendMessage('Launched');
chrome.test.runTests([
testSendMessage,
diff --git a/chrome/test/data/extensions/platform_apps/ephemeral_apps/messaging_sender_success/main.js b/chrome/test/data/extensions/platform_apps/ephemeral_apps/messaging_sender_success/main.js
index 9665b10..7f26437 100644
--- a/chrome/test/data/extensions/platform_apps/ephemeral_apps/messaging_sender_success/main.js
+++ b/chrome/test/data/extensions/platform_apps/ephemeral_apps/messaging_sender_success/main.js
@@ -41,6 +41,7 @@ function testConnect() {
}
chrome.app.runtime.onLaunched.addListener(function() {
+ chrome.test.sendMessage('Launched');
chrome.test.runTests([
testSendMessage,
diff --git a/chrome/test/data/extensions/platform_apps/launch/test.js b/chrome/test/data/extensions/platform_apps/launch/test.js
index 07fd91c..120e5fd 100644
--- a/chrome/test/data/extensions/platform_apps/launch/test.js
+++ b/chrome/test/data/extensions/platform_apps/launch/test.js
@@ -3,5 +3,6 @@
// found in the LICENSE file.
chrome.app.runtime.onLaunched.addListener(function() {
+ chrome.test.sendMessage('Launched');
chrome.test.notifyPass();
});
diff --git a/chrome/test/data/extensions/platform_apps/launch_2/test.js b/chrome/test/data/extensions/platform_apps/launch_2/test.js
index 07fd91c..120e5fd 100644
--- a/chrome/test/data/extensions/platform_apps/launch_2/test.js
+++ b/chrome/test/data/extensions/platform_apps/launch_2/test.js
@@ -3,5 +3,6 @@
// found in the LICENSE file.
chrome.app.runtime.onLaunched.addListener(function() {
+ chrome.test.sendMessage('Launched');
chrome.test.notifyPass();
});
diff --git a/chrome/test/data/extensions/platform_apps/messaging/app1/background.js b/chrome/test/data/extensions/platform_apps/messaging/app1/background.js
index 5371048..f9fa4ea 100644
--- a/chrome/test/data/extensions/platform_apps/messaging/app1/background.js
+++ b/chrome/test/data/extensions/platform_apps/messaging/app1/background.js
@@ -26,6 +26,8 @@ function testConversation(port) {
port.postMessage('message_1');
}
+chrome.test.sendMessage('Launched');
+
chrome.test.runTests([
function connect() {
diff --git a/chrome/test/data/extensions/platform_apps/messaging/app2/background.js b/chrome/test/data/extensions/platform_apps/messaging/app2/background.js
index 07ef1ba..6f05fed 100644
--- a/chrome/test/data/extensions/platform_apps/messaging/app2/background.js
+++ b/chrome/test/data/extensions/platform_apps/messaging/app2/background.js
@@ -4,6 +4,8 @@
var otherId = 'ljhhihhmjomkjokmknellgbidphmahkh';
+chrome.test.sendMessage('Launched');
+
chrome.runtime.onConnectExternal.addListener(function(port) {
port.onMessage.addListener(function(msg) {
if (msg == 'ok_to_disconnect') {
diff --git a/chrome/test/data/extensions/platform_apps/open_link/main.js b/chrome/test/data/extensions/platform_apps/open_link/main.js
index 56575db..f946b8e 100644
--- a/chrome/test/data/extensions/platform_apps/open_link/main.js
+++ b/chrome/test/data/extensions/platform_apps/open_link/main.js
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+chrome.test.sendMessage('Launched');
+
chrome.test.getConfig(function(config) {
var linkNode = document.getElementById('test-link');
linkNode.href = 'http://localhost:' + config.testServer.port +
diff --git a/chrome/test/data/extensions/platform_apps/web_view/isolation/main.js b/chrome/test/data/extensions/platform_apps/web_view/isolation/main.js
index 702e803..8f32cba 100644
--- a/chrome/test/data/extensions/platform_apps/web_view/isolation/main.js
+++ b/chrome/test/data/extensions/platform_apps/web_view/isolation/main.js
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+chrome.test.sendMessage('Launched');
+
chrome.test.getConfig(function(config) {
var url = 'http://localhost:' + config.testServer.port +
'/extensions/platform_apps/web_view/isolation/cookie.html';
@@ -31,5 +33,4 @@ chrome.test.getConfig(function(config) {
"'></webview>" +
"<webview id='webview7' partition='persist:2' src='" + url7 +
"'></webview>";
- chrome.test.sendMessage('Launched');
});