diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-21 00:32:45 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-21 00:32:45 +0000 |
commit | a8a812927466ad39a65b718049ffcd76c24e6a1e (patch) | |
tree | 349d438d0436fad66fcf2c83ccb6c52722794b06 /chrome/test/ui_test_utils.cc | |
parent | c55fd9484f10cb72736e0a6688f7ed0db5435af8 (diff) | |
download | chromium_src-a8a812927466ad39a65b718049ffcd76c24e6a1e.zip chromium_src-a8a812927466ad39a65b718049ffcd76c24e6a1e.tar.gz chromium_src-a8a812927466ad39a65b718049ffcd76c24e6a1e.tar.bz2 |
One more attempt at landing this CL.
There are now memory errors in the CLD library that cause memory crashers in reliability tests.
I will add reliability failures to the know_crashes.txt file while the memory errors are being fixed.
Original review:
http://codereview.chromium.org/492024/show
BUG=30662
TEST=Run the unit-tests.
TBR=brettw
Review URL: http://codereview.chromium.org/555014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36707 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/ui_test_utils.cc')
-rw-r--r-- | chrome/test/ui_test_utils.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc index db83689..4c04d20 100644 --- a/chrome/test/ui_test_utils.cc +++ b/chrome/test/ui_test_utils.cc @@ -257,6 +257,33 @@ class SimpleNotificationObserver : public NotificationObserver { DISALLOW_COPY_AND_ASSIGN(SimpleNotificationObserver); }; +class LanguageDetectionNotificationObserver : public NotificationObserver { + public: + explicit LanguageDetectionNotificationObserver( + RenderViewHost* render_view_host) { + registrar_.Add(this, NotificationType::TAB_LANGUAGE_DETERMINED, + Source<RenderViewHost>(render_view_host)); + ui_test_utils::RunMessageLoop(); + } + + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + language_ = *(Details<std::string>(details).ptr()); + MessageLoopForUI::current()->Quit(); + } + + std::string language() const { + return language_; + } + + private: + NotificationRegistrar registrar_; + std::string language_; + + DISALLOW_COPY_AND_ASSIGN(LanguageDetectionNotificationObserver); +}; + class FindInPageNotificationObserver : public NotificationObserver { public: explicit FindInPageNotificationObserver(TabContents* parent_tab) @@ -494,6 +521,11 @@ void WaitForFocusInBrowser(Browser* browser) { browser); } +std::string WaitForLanguageDetection(TabContents* tab) { + LanguageDetectionNotificationObserver observer(tab->render_view_host()); + return observer.language(); +} + int FindInPage(TabContents* tab_contents, const string16& search_string, bool forward, bool match_case, int* ordinal) { tab_contents->StartFinding(search_string, forward, match_case); |