From 599f982a262960408e6a6485be64156dfd0b3240 Mon Sep 17 00:00:00 2001 From: "benwells@chromium.org" Date: Tue, 17 Jun 2014 09:41:27 +0000 Subject: 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 --- apps/app_restore_service_browsertest.cc | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'apps/app_restore_service_browsertest.cc') 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()); -- cgit v1.1