diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-13 00:09:47 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-13 00:09:47 +0000 |
commit | b40f8640305e66d937ba4df7cc6c6ae4aad6f141 (patch) | |
tree | 30457d27acd714080ac1ea9e01df040505feaea0 /chrome_frame | |
parent | cfcc06ae4e543282647bb6ccb73bd333f3726f9a (diff) | |
download | chromium_src-b40f8640305e66d937ba4df7cc6c6ae4aad6f141.zip chromium_src-b40f8640305e66d937ba4df7cc6c6ae4aad6f141.tar.gz chromium_src-b40f8640305e66d937ba4df7cc6c6ae4aad6f141.tar.bz2 |
Reverting this as a number of tests have been failing on all builders ever since. Please look into this and resubmit.
Revert 47065 - An attempt to catch unexpected script errors in html test pages in a more generic way.
TEST=This is meant to help track down flakiness of a few tests.
BUG=none
Review URL: http://codereview.chromium.org/2052006
TBR=tommi@chromium.org
Review URL: http://codereview.chromium.org/2011017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47099 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/test/data/chrome_frame_tester_helpers.js | 18 | ||||
-rw-r--r-- | chrome_frame/test/test_mock_with_web_server.cc | 78 | ||||
-rw-r--r-- | chrome_frame/test/test_with_web_server.cc | 14 | ||||
-rw-r--r-- | chrome_frame/test/test_with_web_server.h | 4 |
4 files changed, 5 insertions, 109 deletions
diff --git a/chrome_frame/test/data/chrome_frame_tester_helpers.js b/chrome_frame/test/data/chrome_frame_tester_helpers.js index eefde47..a6cc9c2 100644 --- a/chrome_frame/test/data/chrome_frame_tester_helpers.js +++ b/chrome_frame/test/data/chrome_frame_tester_helpers.js @@ -1,17 +1,6 @@ // // This script provides some mechanics for testing ChromeFrame // - -var reportURL = "/writefile/"; - -// Start by setting a default error handler. -// Use onerror without any arguments due to webkit bugs 7771 and 8939. -window.onerror = new function() { - onFailure("tester_helpers", "script exception", window.location.href); - return true; -} - - function onSuccess(name, id) { appendStatus("Success reported!"); onFinished(name, id, "OK"); @@ -26,7 +15,7 @@ function byId(id) { return document.getElementById(id); } -function getXHRObject() { +function getXHRObject(){ var XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0']; var http = null; @@ -51,6 +40,8 @@ function getXHRObject() { return http; } +var reportURL = "/writefile/"; + function shutdownServer() { var xhr = getXHRObject(); if(!xhr) @@ -76,8 +67,7 @@ function writeToServer(name, result) { return; // synchronously POST the results - var target = reportURL + name; - xhr.open("POST", target, false); + xhr.open("POST", reportURL + name, false); xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); try { xhr.send(result); diff --git a/chrome_frame/test/test_mock_with_web_server.cc b/chrome_frame/test/test_mock_with_web_server.cc index 5e99e66..0b7ce1e 100644 --- a/chrome_frame/test/test_mock_with_web_server.cc +++ b/chrome_frame/test/test_mock_with_web_server.cc @@ -320,9 +320,6 @@ TEST(ChromeFrameTest, FullTabModeIE_DisallowedUrls) { ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LOG(ERROR) << __FUNCTION__ " - timeout!"; - } } const wchar_t kKeyEventUrl[] = L"http://localhost:1337/files/keyevent.html"; @@ -354,9 +351,6 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_KeyboardTest) { return; loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } const wchar_t kAboutVersionUrl[] = L"gcf:about:version"; @@ -384,9 +378,6 @@ TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_FocusTest) { // Allow some time for chrome to be launched. loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } const wchar_t kWindowOpenUrl[] = @@ -438,9 +429,6 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_WindowOpenInChrome) { ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } const wchar_t kSubFrameUrl1[] = @@ -485,9 +473,6 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_CtrlN) { ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } // Test page reload with ctrl+R @@ -523,9 +508,6 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_CtrlR) { ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } // Test window close with ctrl+w @@ -549,9 +531,6 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_CtrlW) { ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } // Test address bar navigation with Alt+d and URL @@ -582,9 +561,6 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_AltD) { ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } // This test launches chrome frame in full tab mode in IE by having IE navigate @@ -632,9 +608,6 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_AboutChromeFrame) { ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } // Hack to pass a reference to the argument instead of value. Passing by @@ -705,9 +678,6 @@ TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_BackForward) { ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } const wchar_t kAnchorUrl[] = L"http://localhost:1337/files/anchor.html"; @@ -826,9 +796,6 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_BackForwardAnchor) { ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } // Full tab mode view source test @@ -882,9 +849,6 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_ViewSource) { ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } const wchar_t kBeforeUnloadTest[] = @@ -918,9 +882,6 @@ TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_UnloadEventTest) { ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } // NOTE: This test is currently disabled as we haven't finished implementing @@ -963,9 +924,6 @@ TEST_F(ChromeFrameTestWithWebServer, ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } // Test Back/Forward from context menu. Loads page 1 in chrome and page 2 @@ -1014,9 +972,6 @@ TEST_F(ChromeFrameTestWithWebServer, ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } // Test Reload from context menu. @@ -1050,9 +1005,6 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_ContextMenuReload) { ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } // Test view source using context menu @@ -1102,9 +1054,6 @@ TEST_F(ChromeFrameTestWithWebServer, ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } TEST_F(ChromeFrameTestWithWebServer, @@ -1139,9 +1088,6 @@ TEST_F(ChromeFrameTestWithWebServer, ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } TEST_F(ChromeFrameTestWithWebServer, @@ -1178,9 +1124,6 @@ TEST_F(ChromeFrameTestWithWebServer, ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } TEST_F(ChromeFrameTestWithWebServer, @@ -1223,9 +1166,6 @@ TEST_F(ChromeFrameTestWithWebServer, ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } ASSERT_NE(INVALID_FILE_ATTRIBUTES, GetFileAttributes(kSaveFileName)); ASSERT_TRUE(DeleteFile(kSaveFileName)); @@ -1283,9 +1223,6 @@ TEST_F(ChromeFrameTestWithWebServer, ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } // http://code.google.com/p/chromium/issues/detail?id=38566 @@ -1328,9 +1265,6 @@ TEST_F(ChromeFrameTestWithWebServer, DISABLED_FullTabModeIE_MenuSaveAs) { ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } ASSERT_NE(INVALID_FILE_ATTRIBUTES, GetFileAttributes(kSaveFileName)); ASSERT_TRUE(DeleteFile(kSaveFileName)); @@ -1388,9 +1322,6 @@ TEST_F(ChromeFrameTestWithWebServer, ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds * 2); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } TEST(IEPrivacy, NavigationToRestrictedSite) { @@ -1440,9 +1371,6 @@ TEST(IEPrivacy, NavigationToRestrictedSite) { if (hr == S_OK) { ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds * 2); - if (loop.WasTimedOut()) { - LOG(ERROR) << __FUNCTION__ " - timeout!"; - } } ASSERT_HRESULT_SUCCEEDED(security_manager->SetZoneMapping(URLZONE_UNTRUSTED, @@ -1590,9 +1518,6 @@ TEST_F(ChromeFrameTestWithWebServer, if (hr == S_OK) { ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds * 2); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } EXPECT_EQ(1, response->get_request_count()); @@ -1634,7 +1559,4 @@ TEST_F(ChromeFrameTestWithWebServer, ASSERT_TRUE(mock.web_browser2() != NULL); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - if (loop.WasTimedOut()) { - LogScriptErrorResultFile(); - } } diff --git a/chrome_frame/test/test_with_web_server.cc b/chrome_frame/test/test_with_web_server.cc index ba009c8..815ad86 100644 --- a/chrome_frame/test/test_with_web_server.cc +++ b/chrome_frame/test/test_with_web_server.cc @@ -158,7 +158,7 @@ bool ChromeFrameTestWithWebServer::WaitForOnLoad(int milliseconds) { } bool ChromeFrameTestWithWebServer::ReadResultFile(const std::wstring& file_name, - std::string* data) { + std::string* data) { std::wstring full_path = results_dir_; file_util::AppendToPath(&full_path, file_name); return file_util::ReadFileToString(full_path, data); @@ -171,8 +171,6 @@ bool ChromeFrameTestWithWebServer::CheckResultFile( if (ret) ret = (data == expected_result); - LogScriptErrorResultFile(); - if (!ret) { LOG(ERROR) << "Error text: " << (data.empty() ? "<empty>" : data.c_str()); } @@ -180,16 +178,6 @@ bool ChromeFrameTestWithWebServer::CheckResultFile( return ret; } -void ChromeFrameTestWithWebServer::LogScriptErrorResultFile() { - std::string data; - ReadResultFile(L"tester_helpers", &data); - if (!data.empty()) { - // Data will be set to the URL of the failing page. - LOG(ERROR) << "Script exception: " << data; - } -} - - void ChromeFrameTestWithWebServer::SimpleBrowserTest(BrowserKind browser, const wchar_t* page, const wchar_t* result_file_to_check) { ASSERT_TRUE(LaunchBrowser(browser, page)); diff --git a/chrome_frame/test/test_with_web_server.h b/chrome_frame/test/test_with_web_server.h index f670717..2f3c05d7 100644 --- a/chrome_frame/test/test_with_web_server.h +++ b/chrome_frame/test/test_with_web_server.h @@ -62,10 +62,6 @@ class ChromeFrameTestWithWebServer: public testing::Test { bool CheckResultFile(const std::wstring& file_name, const std::string& expected_result); - // If a script error was caught and reported by chrome_frame_test_helpers.js, - // we log it as an error. - void LogScriptErrorResultFile(); - const FilePath& GetCFTestFilePath() { return test_file_path_; } |