summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpam@chromium.org <pam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-20 23:14:18 +0000
committerpam@chromium.org <pam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-20 23:14:18 +0000
commit81ccef9d2941a3b6708564b634f6e79f00bc6ab9 (patch)
tree82cfa58e1dbe4fa72316324af36e0ab08d7da8cc /chrome
parentcc3d2d551dbc6620072f8e6e193200698a2c9786 (diff)
downloadchromium_src-81ccef9d2941a3b6708564b634f6e79f00bc6ab9.zip
chromium_src-81ccef9d2941a3b6708564b634f6e79f00bc6ab9.tar.gz
chromium_src-81ccef9d2941a3b6708564b634f6e79f00bc6ab9.tar.bz2
Disable check for active window when it doesn't look like Chromium is the front
app. This should fix the buildbots but still allow a manual test. TBR=erikkay BUG=5278 TEST=run ui_tests with another app at the front. Make sure TabRestoreUITest.* pass with no "is_active" failures. Review URL: http://codereview.chromium.org/88012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14068 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/tab_restore_uitest.cc25
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;