diff options
author | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-25 12:43:30 +0000 |
---|---|---|
committer | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-25 12:43:30 +0000 |
commit | c711fe71d939fe5f0f535e4ecefcd6b1f62d07b5 (patch) | |
tree | 6288253dc76369230d14b186803fc075a537a0a8 /chrome/browser/debugger/devtools_sanity_unittest.cc | |
parent | e547ac8ff87ecb90b6dd97ad9e897a773d4a0120 (diff) | |
download | chromium_src-c711fe71d939fe5f0f535e4ecefcd6b1f62d07b5.zip chromium_src-c711fe71d939fe5f0f535e4ecefcd6b1f62d07b5.tar.gz chromium_src-c711fe71d939fe5f0f535e4ecefcd6b1f62d07b5.tar.bz2 |
DevTools: use standard test utilities instead of custom ones where possible
BUG=None
TEST=WorkerDevToolsSanityTest.InspectSharedWorker
Review URL: http://codereview.chromium.org/7492046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93878 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/debugger/devtools_sanity_unittest.cc')
-rw-r--r-- | chrome/browser/debugger/devtools_sanity_unittest.cc | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/chrome/browser/debugger/devtools_sanity_unittest.cc b/chrome/browser/debugger/devtools_sanity_unittest.cc index 6886cf8..d668cd2 100644 --- a/chrome/browser/debugger/devtools_sanity_unittest.cc +++ b/chrome/browser/debugger/devtools_sanity_unittest.cc @@ -5,6 +5,7 @@ #include "base/command_line.h" #include "base/path_service.h" #include "base/stringprintf.h" +#include "base/test/test_timeouts.h" #include "base/utf_string_conversions.h" #include "chrome/browser/debugger/devtools_window.h" #include "chrome/browser/extensions/extension_host.h" @@ -254,33 +255,6 @@ class DevToolsExtensionDebugTest : public DevToolsSanityTest, }; - -// Used to block until a navigation completes. -class LoadStopObserver : public NotificationObserver { - public: - explicit LoadStopObserver(const NotificationSource& source) : done_(false) { - registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source); - ui_test_utils::RunMessageLoop(); - } - - private: - virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { - if (type == content::NOTIFICATION_LOAD_STOP) { - if (done_) - return; - done_ = true; - MessageLoopForUI::current()->Quit(); - } - } - - NotificationRegistrar registrar_; - bool done_; - DISALLOW_COPY_AND_ASSIGN(LoadStopObserver); -}; - - class WorkerDevToolsSanityTest : public InProcessBrowserTest { public: WorkerDevToolsSanityTest() : window_(NULL) { @@ -318,12 +292,13 @@ class WorkerDevToolsSanityTest : public InProcessBrowserTest { if (found) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, new MessageLoop::QuitTask); - } else if (attempt < 30) { + } else if (attempt < TestTimeouts::action_timeout_ms() / + TestTimeouts::tiny_timeout_ms()) { MessageLoop::current()->PostDelayedTask( FROM_HERE, NewRunnableFunction( &OpenDevToolsWindowForFirstSharedWorkerOnIOThread, attempt + 1), - 100); + TestTimeouts::tiny_timeout_ms()); } else { FAIL() << "Shared worker not found."; } @@ -341,8 +316,10 @@ class WorkerDevToolsSanityTest : public InProcessBrowserTest { RenderViewHost* client_rvh = window_->GetRenderViewHost(); TabContents* client_contents = client_rvh->delegate()->GetAsTabContents(); if (client_contents->IsLoading()) { - LoadStopObserver( + ui_test_utils::WindowedNotificationObserver observer( + content::NOTIFICATION_LOAD_STOP, Source<NavigationController>(&client_contents->controller())); + observer.Wait(); } } |