| Index: chrome/test/in_process_browser_test.cc
|
| ===================================================================
|
| --- chrome/test/in_process_browser_test.cc (revision 19688)
|
| +++ chrome/test/in_process_browser_test.cc (working copy)
|
| @@ -33,6 +33,13 @@
|
|
|
| const wchar_t kUnitTestShowWindows[] = L"show-windows";
|
|
|
| +// Delay for the time-out at which we stop the inner-message loop the first
|
| +// time.
|
| +const int kInitialTimeoutInMS = 30000;
|
| +
|
| +// Delay for sub-sequent time-outs once the initial time-out happened.
|
| +const int kSubsequentTimeoutInMS = 5000;
|
| +
|
| namespace {
|
|
|
| bool DieFileDie(const std::wstring& file, bool recurse) {
|
| @@ -205,6 +212,11 @@
|
|
|
| browser_ = CreateBrowser(profile);
|
|
|
| + // Start the timeout timer to prevent hangs.
|
| + MessageLoopForUI::current()->PostDelayedTask(FROM_HERE,
|
| + NewRunnableMethod(this, &InProcessBrowserTest::TimedOut),
|
| + kInitialTimeoutInMS);
|
| +
|
| RunTestOnMainThread();
|
|
|
| BrowserList::const_iterator browser = BrowserList::begin();
|
| @@ -224,3 +236,16 @@
|
| // We don't want the test code to use it.
|
| host_mapper->AddSimulatedFailure("wpad");
|
| }
|
| +
|
| +void InProcessBrowserTest::TimedOut() {
|
| + DCHECK(MessageLoopForUI::current()->IsNested());
|
| +
|
| + GTEST_NONFATAL_FAILURE_("Timed-out");
|
| +
|
| + // Start the timeout timer to prevent hangs.
|
| + MessageLoopForUI::current()->PostDelayedTask(FROM_HERE,
|
| + NewRunnableMethod(this, &InProcessBrowserTest::TimedOut),
|
| + kSubsequentTimeoutInMS);
|
| +
|
| + MessageLoopForUI::current()->Quit();
|
| +}
|
|
|