Skip to content

Commit

Permalink
Fix flaky ExtensionBrowserTest.IncognitoYesScript.
Browse files Browse the repository at this point in the history
BUG=35885

Review URL: http://codereview.chromium.org/611002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39163 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
mpcomplete@chromium.org committed Feb 16, 2010
1 parent 993c828 commit 77bd2ce
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions chrome/browser/extensions/incognito_noscript_apitest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, IncognitoNoScript) {
GURL("http://www.example.com:1337/files/extensions/test_file.html"));
Browser* otr_browser = BrowserList::FindBrowserWithType(
browser()->profile()->GetOffTheRecordProfile(), Browser::TYPE_NORMAL);
TabContents* tab = otr_browser->GetSelectedTabContents();

string16 title;
ui_test_utils::GetCurrentTabTitle(otr_browser, &title);
ASSERT_EQ("Unmodified", UTF16ToASCII(title));
// Verify the script didn't run.
bool result = false;
ui_test_utils::ExecuteJavaScriptAndExtractBool(
tab->render_view_host(), L"",
L"window.domAutomationController.send(document.title == 'Unmodified')",
&result);
EXPECT_TRUE(result);
}

// Flaky, see: http://crbug.com/35885.
IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_IncognitoYesScript) {
IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, IncognitoYesScript) {
host_resolver()->AddRule("*", "127.0.0.1");
StartHTTPServer();

Expand Down Expand Up @@ -72,8 +76,13 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, FLAKY_IncognitoYesScript) {
GURL("http://www.example.com:1337/files/extensions/test_file.html"));
Browser* otr_browser = BrowserList::FindBrowserWithType(
browser()->profile()->GetOffTheRecordProfile(), Browser::TYPE_NORMAL);
TabContents* tab = otr_browser->GetSelectedTabContents();

string16 title;
ui_test_utils::GetCurrentTabTitle(otr_browser, &title);
ASSERT_EQ("modified", UTF16ToASCII(title));
// Verify the script ran.
bool result = false;
ui_test_utils::ExecuteJavaScriptAndExtractBool(
tab->render_view_host(), L"",
L"window.domAutomationController.send(document.title == 'modified')",
&result);
EXPECT_TRUE(result);
}

0 comments on commit 77bd2ce

Please sign in to comment.