diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-03 23:49:17 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-03 23:49:17 +0000 |
commit | bde9617672d03e32e98dfe5f5aa17d3bd568dd54 (patch) | |
tree | 1dbd7abbe9c26890c33d524bf9ddb0c6d8e6a7f0 /chrome_frame/test | |
parent | c12cfc336a84875997258a5425c077e4726ca2a5 (diff) | |
download | chromium_src-bde9617672d03e32e98dfe5f5aa17d3bd568dd54.zip chromium_src-bde9617672d03e32e98dfe5f5aa17d3bd568dd54.tar.gz chromium_src-bde9617672d03e32e98dfe5f5aa17d3bd568dd54.tar.bz2 |
Attempt to fix the flakiness associated with the ChromeFrame FullTabModeIE_TestMultipleGet and FullTabModeIE_TestPostReissue
tests. These tests expect the last request received to be /quit?OK. However at times it appears that we receive an additional
accept request which ends up failing this test.
Fix is to add a custom function which returns the request associated with a path. Changed the expectations accordingly.
Review URL: http://codereview.chromium.org/1903001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46298 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test')
-rw-r--r-- | chrome_frame/test/test_with_web_server.cc | 19 | ||||
-rw-r--r-- | chrome_frame/test/test_with_web_server.h | 18 |
2 files changed, 28 insertions, 9 deletions
diff --git a/chrome_frame/test/test_with_web_server.cc b/chrome_frame/test/test_with_web_server.cc index 29b3988..2d98161 100644 --- a/chrome_frame/test/test_with_web_server.cc +++ b/chrome_frame/test/test_with_web_server.cc @@ -836,11 +836,12 @@ TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_TestPostReissue) { loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - // Check if the last request to /quit gave us the OK signal. - const test_server::Request& r = server.last_request(); - EXPECT_EQ("OK", r.arguments()); + const test_server::Request* request = NULL; + server.FindRequest("/quit?OK", &request); + ASSERT_TRUE(request != NULL); + EXPECT_EQ("OK", request->arguments()); - if (r.arguments().compare("OK") == 0) { + if (request->arguments().compare("OK") == 0) { // Check how many requests we got for the cf page. Also expect it to be // a POST. int requests = server.GetRequestCountForPage(kPages[1], "POST"); @@ -866,17 +867,19 @@ TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_TestMultipleGet) { }; SimpleWebServerTest server(46664); + server.PopulateStaticFileList(kPages, arraysize(kPages), GetCFTestFilePath()); ASSERT_TRUE(LaunchBrowser(IE, server.FormatHttpPath(kPages[0]).c_str())); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); - // Check if the last request to /quit gave us the OK signal. - const test_server::Request& r = server.last_request(); - EXPECT_EQ("OK", r.arguments()); + const test_server::Request* request = NULL; + server.FindRequest("/quit?OK", &request); + ASSERT_TRUE(request != NULL); + EXPECT_EQ("OK", request->arguments()); - if (r.arguments().compare("OK") == 0) { + if (request->arguments().compare("OK") == 0) { // Check how many requests we got for the cf page and check that it was // a GET. int requests = server.GetRequestCountForPage(kPages[1], "GET"); diff --git a/chrome_frame/test/test_with_web_server.h b/chrome_frame/test/test_with_web_server.h index f1c9334..2f3c05d7 100644 --- a/chrome_frame/test/test_with_web_server.h +++ b/chrome_frame/test/test_with_web_server.h @@ -129,6 +129,21 @@ class SimpleWebServerTest { return c->request(); } + bool FindRequest(const std::string& path, + const test_server::Request** request) { + test_server::ConnectionList::const_iterator index; + for (index = server_.connections().begin(); + index != server_.connections().end(); index++) { + const test_server::Connection* connection = *index; + if (!lstrcmpiA(connection->request().path().c_str(), path.c_str())) { + if (request) + *request = &connection->request(); + return true; + } + } + return false; + } + // Counts the number of times a page was requested. // Optionally checks if the request method for each is equal to // |expected_method|. If expected_method is NULL no such check is made. @@ -140,7 +155,8 @@ class SimpleWebServerTest { for (it = connections.begin(); it != connections.end(); ++it) { const test_server::Connection* c = (*it); const test_server::Request& r = c->request(); - if (ASCIIToWide(r.path().substr(1)).compare(page) == 0) { + if (!r.path().empty() && + ASCIIToWide(r.path().substr(1)).compare(page) == 0) { if (expected_method) { EXPECT_EQ(expected_method, r.method()); } |