Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1168)

Unified Diff: chrome/test/ui/ui_test.cc

Issue 149281: Sprinkle some defensiveness into the UI tests so that they don't explode if t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/ui/sunspider_uitest.cc ('k') | chrome/worker/worker_uitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/ui/ui_test.cc
===================================================================
--- chrome/test/ui/ui_test.cc (revision 19956)
+++ chrome/test/ui/ui_test.cc (working copy)
@@ -546,9 +546,12 @@
scoped_refptr<TabProxy> UITest::GetActiveTab(int window_index) {
EXPECT_GE(window_index, 0);
- int window_count;
- // Use EXPECT rather than ASSERT here because ASSERT_* returns void.
+ int window_count = -1;
+ // We have to use EXPECT rather than ASSERT here because ASSERT_* only works
+ // in functions that return void.
EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count));
+ if (window_count == -1)
+ return NULL;
EXPECT_GT(window_count, window_index);
scoped_refptr<BrowserProxy> window_proxy(automation()->
GetBrowserWindow(window_index));
@@ -895,12 +898,14 @@
cookie_name.append(test_complete_cookie);
scoped_refptr<TabProxy> tab(GetActiveTab());
-
- bool test_result = WaitUntilCookieValue(tab.get(), url,
- cookie_name.c_str(),
- kIntervalMilliSeconds, wait_time,
- expected_cookie_value.c_str());
- EXPECT_EQ(true, test_result);
+ EXPECT_TRUE(tab.get());
+ if (tab.get()) {
+ bool test_result = WaitUntilCookieValue(tab.get(), url,
+ cookie_name.c_str(),
+ kIntervalMilliSeconds, wait_time,
+ expected_cookie_value.c_str());
+ EXPECT_EQ(true, test_result);
+ }
}
void UITest::PrintResult(const std::string& measurement,
« no previous file with comments | « chrome/test/ui/sunspider_uitest.cc ('k') | chrome/worker/worker_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698