diff options
Diffstat (limited to 'chrome/browser/tab_restore_uitest.cc')
-rw-r--r-- | chrome/browser/tab_restore_uitest.cc | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/chrome/browser/tab_restore_uitest.cc b/chrome/browser/tab_restore_uitest.cc index 109c768..7c7956f 100644 --- a/chrome/browser/tab_restore_uitest.cc +++ b/chrome/browser/tab_restore_uitest.cc @@ -52,13 +52,27 @@ class TabRestoreUITest : public UITest { // Ensure that the given browser occupies the currently active window. void CheckActiveWindow(const BrowserProxy* browser) { - // The EXPECT_TRUE may fail during manual debugging, as well as if a user - // does other things while running the tests, because Chromium won't be - // the foremost application at all. bool is_active = false; scoped_ptr<WindowProxy> window_proxy(browser->GetWindow()); ASSERT_TRUE(window_proxy->IsActive(&is_active)); - EXPECT_TRUE(is_active); + // The EXPECT_TRUE may fail if other apps are active while running the + // tests, because Chromium won't be the foremost application at all. To + // prevent this from turning the buildbots red, we disable the check + // entirely if it failed the first time we tried it. Thus the first + // CheckActiveWindow() call we encounter should be in a situation that's + // virtually guaranteed to be correct. + static int check_flag = 0; // 0 = first run, -1 = don't check, 1 = do check + if (!check_flag) { + if (is_active) { + check_flag = 1; + } else { + check_flag = -1; + LOG(ERROR) << "CheckActiveWindow disabled for all TabRestoreUITest.*" + " because Chromium is not the front app."; + } + } + if (check_flag == 1) + EXPECT_TRUE(is_active); } GURL url1_; @@ -150,6 +164,9 @@ TEST_F(TabRestoreUITest, MiddleTab) { TEST_F(TabRestoreUITest, RestoreToDifferentWindow) { scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); + // This call is virtually guaranteed to pass, assuming that Chromium is the + // active application, which will establish a baseline for later calls to + // CheckActiveWindow(). See comments in that function. CheckActiveWindow(browser_proxy.get()); int tab_count; |