diff options
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_browsertest.cc | 6 | ||||
-rw-r--r-- | chrome/browser/history/history_browsertest.cc | 12 | ||||
-rw-r--r-- | chrome/test/base/ui_test_utils.cc | 5 | ||||
-rw-r--r-- | chrome/test/base/ui_test_utils.h | 5 |
4 files changed, 17 insertions, 11 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_browsertest.cc b/chrome/browser/autocomplete/autocomplete_browsertest.cc index f9058c7..f5c1962 100644 --- a/chrome/browser/autocomplete/autocomplete_browsertest.cc +++ b/chrome/browser/autocomplete/autocomplete_browsertest.cc @@ -102,7 +102,8 @@ IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, Basic) { IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, MAYBE_Autocomplete) { // The results depend on the history backend being loaded. Make sure it is // loaded so that the autocomplete results are consistent. - ui_test_utils::WaitForHistoryToLoad(browser()); + ui_test_utils::WaitForHistoryToLoad( + browser()->profile()->GetHistoryService(Profile::EXPLICIT_ACCESS)); LocationBar* location_bar = GetLocationBar(); AutocompleteController* autocomplete_controller = GetAutocompleteController(); @@ -264,7 +265,8 @@ IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, ExtensionAppProvider) { // The results depend on the history backend being loaded. Make sure it is // loaded so that the autocomplete results are consistent. - ui_test_utils::WaitForHistoryToLoad(browser()); + ui_test_utils::WaitForHistoryToLoad( + browser()->profile()->GetHistoryService(Profile::EXPLICIT_ACCESS)); AutocompleteController* autocomplete_controller = GetAutocompleteController(); diff --git a/chrome/browser/history/history_browsertest.cc b/chrome/browser/history/history_browsertest.cc index 84d3c49..3934cee 100644 --- a/chrome/browser/history/history_browsertest.cc +++ b/chrome/browser/history/history_browsertest.cc @@ -157,7 +157,8 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryEnabled) { EXPECT_TRUE(GetProfile()->GetHistoryService(Profile::EXPLICIT_ACCESS)); EXPECT_TRUE(GetProfile()->GetHistoryService(Profile::IMPLICIT_ACCESS)); - ui_test_utils::WaitForHistoryToLoad(browser()); + ui_test_utils::WaitForHistoryToLoad( + browser()->profile()->GetHistoryService(Profile::EXPLICIT_ACCESS)); ExpectEmptyHistory(); ui_test_utils::NavigateToURL(browser(), GetTestUrl()); @@ -177,7 +178,8 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryDisabled) { EXPECT_TRUE(GetProfile()->GetHistoryService(Profile::EXPLICIT_ACCESS)); EXPECT_FALSE(GetProfile()->GetHistoryService(Profile::IMPLICIT_ACCESS)); - ui_test_utils::WaitForHistoryToLoad(browser()); + ui_test_utils::WaitForHistoryToLoad( + browser()->profile()->GetHistoryService(Profile::EXPLICIT_ACCESS)); ExpectEmptyHistory(); ui_test_utils::NavigateToURL(browser(), GetTestUrl()); @@ -190,7 +192,8 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryDisabled) { IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryEnabledThenDisabled) { EXPECT_FALSE(GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled)); - ui_test_utils::WaitForHistoryToLoad(browser()); + ui_test_utils::WaitForHistoryToLoad( + browser()->profile()->GetHistoryService(Profile::EXPLICIT_ACCESS)); ui_test_utils::NavigateToURL(browser(), GetTestUrl()); WaitForHistoryBackendToRun(); @@ -219,7 +222,8 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryEnabledThenDisabled) { IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryDisabledThenEnabled) { GetPrefs()->SetBoolean(prefs::kSavingBrowserHistoryDisabled, true); - ui_test_utils::WaitForHistoryToLoad(browser()); + ui_test_utils::WaitForHistoryToLoad( + browser()->profile()->GetHistoryService(Profile::EXPLICIT_ACCESS)); ExpectEmptyHistory(); ui_test_utils::NavigateToURL(browser(), GetTestUrl()); diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index fb7c02b..c1b4619 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -28,6 +28,7 @@ #include "base/values.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/history/history.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/template_url_service_test_util.h" @@ -724,9 +725,7 @@ void WaitForTemplateURLServiceToLoad(TemplateURLService* service) { ASSERT_TRUE(service->loaded()); } -void WaitForHistoryToLoad(Browser* browser) { - HistoryService* history_service = - browser->profile()->GetHistoryService(Profile::EXPLICIT_ACCESS); +void WaitForHistoryToLoad(HistoryService* history_service) { WindowedNotificationObserver history_loaded_observer( chrome::NOTIFICATION_HISTORY_LOADED, content::NotificationService::AllSources()); diff --git a/chrome/test/base/ui_test_utils.h b/chrome/test/base/ui_test_utils.h index e510201..37f491c 100644 --- a/chrome/test/base/ui_test_utils.h +++ b/chrome/test/base/ui_test_utils.h @@ -46,6 +46,7 @@ class CommandLine; class ExtensionAction; class FilePath; class GURL; +class HistoryService; class MessageLoop; class Profile; class ScopedTempDir; @@ -259,8 +260,8 @@ void WaitForBookmarkModelToLoad(BookmarkModel* model); // Blocks until |service| finishes loading. void WaitForTemplateURLServiceToLoad(TemplateURLService* service); -// Blocks until the |browser|'s history finishes loading. -void WaitForHistoryToLoad(Browser* browser); +// Blocks until the |history_service|'s history finishes loading. +void WaitForHistoryToLoad(HistoryService* history_service); // Puts the native window for |browser| in |native_window|. Returns true on // success. |