diff options
author | stoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-19 07:27:27 +0000 |
---|---|---|
committer | stoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-19 07:27:27 +0000 |
commit | 5c34e39cea9e91fda04224aa7f5cb490fd5fb0c4 (patch) | |
tree | b30014e7c4d4f4be968ee4fa358948c0aa8739e1 /chrome_frame | |
parent | 12ea22a1337a63db017338156ba56abd62beacbd (diff) | |
download | chromium_src-5c34e39cea9e91fda04224aa7f5cb490fd5fb0c4.zip chromium_src-5c34e39cea9e91fda04224aa7f5cb490fd5fb0c4.tar.gz chromium_src-5c34e39cea9e91fda04224aa7f5cb490fd5fb0c4.tar.bz2 |
Move use_host_network test out of ChromeFrame.
Some refactoring of ExternalTabUITestMockClient.
TEST=ui_tests
Review URL: http://codereview.chromium.org/384058
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32504 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/test/chrome_frame_unittests.cc | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/chrome_frame/test/chrome_frame_unittests.cc b/chrome_frame/test/chrome_frame_unittests.cc index c9d081a..1f2340d 100644 --- a/chrome_frame/test/chrome_frame_unittests.cc +++ b/chrome_frame/test/chrome_frame_unittests.cc @@ -768,34 +768,6 @@ struct MockCFDelegate : public ChromeFrameDelegateImpl { .Times(testing::AnyNumber()); } - // Response sender helpers - void ReplyStarted(const IPC::AutomationURLResponse* response, - int tab_handle, int request_id, - const IPC::AutomationURLRequest& request) { - automation_->Send(new AutomationMsg_RequestStarted(0, tab_handle, - request_id, *response)); - } - - void ReplyData(const std::string* data, int tab_handle, int request_id, - int bytes_to_read) { - automation_->Send(new AutomationMsg_RequestData(0, tab_handle, - request_id, *data)); - } - - void ReplyEOF(int tab_handle, int request_id) { - automation_->Send(new AutomationMsg_RequestEnd(0, tab_handle, - request_id, URLRequestStatus())); - } - - void Reply404(int tab_handle, int request_id, - const IPC::AutomationURLRequest& request) { - const IPC::AutomationURLResponse notfound = {"", "HTTP/1.1 404\r\n\r\n"}; - automation_->Send(new AutomationMsg_RequestStarted(0, tab_handle, - request_id, notfound)); - automation_->Send(new AutomationMsg_RequestEnd(0, tab_handle, - request_id, URLRequestStatus())); - } - IPC::Message::Sender* automation_; }; @@ -1035,113 +1007,6 @@ TEST(CFACWithChrome, DISABLED_NavigateFailed) { client = NULL; } -MATCHER_P(EqURLRequest, x, "IPC::AutomationURLRequest matcher") { - if (arg.url != x.url) - return false; - if (arg.method != x.method) - return false; - if (arg.referrer != x.referrer) - return false; - if (arg.extra_request_headers != x.extra_request_headers) - return false; - // TODO(stevet): uploaddata member - return true; -} - -MATCHER_P(EqUrlGet, url, "Quick URL matcher for 'HTTP GET' request") { - if (arg.url != url) - return false; - if (arg.method != "GET") - return false; - return true; -} - -TEST(CFACWithChrome, UseHostNetworkStack) { - MockCFDelegate cfd; - TimedMsgLoop loop; - const std::wstring profile = L"Adam.N.Epilinter"; - const std::string url = "http://bongo.com"; - int timeout = 10000; - - scoped_refptr<ChromeFrameAutomationClient> client; - client = new ChromeFrameAutomationClient; - client->set_use_chrome_network(false); - cfd.SetAutomationSender(client.get()); - - EXPECT_CALL(cfd, OnAutomationServerReady()) - .WillOnce(testing::IgnoreResult(testing::InvokeWithoutArgs(CreateFunctor( - client.get(), &ChromeFrameAutomationClient::InitiateNavigation, - url, std::string(), false)))); - - EXPECT_CALL(cfd, OnNavigationStateChanged(testing::_, testing::_)) - .Times(testing::AnyNumber()); - - EXPECT_CALL(cfd, GetBounds(testing::_)) - .Times(testing::AtMost(1)); - - EXPECT_CALL(cfd, OnUpdateTargetUrl(testing::_, testing::_)) - .Times(testing::AnyNumber()); - - // Note slash appending to the url string, because of GURL inside chrome - const IPC::AutomationURLResponse found = {"", "HTTP/0.9 200\r\n\r\n\r\n", }; - - // Hard coded tab and request ids - static const int tab_id = 1; - int request_id = 2; - - EXPECT_CALL(cfd, OnRequestStart(tab_id, request_id, EqUrlGet(url + '/'))) - .Times(1) - .WillOnce(testing::Invoke(CreateFunctor(&cfd, - &MockCFDelegate::ReplyStarted, - &found))); - - // Return some trivial page, that have a link to a "logo.gif" image - const std::string data = "<!DOCTYPE html><title>Hello</title>" - "<img src=\"logo.gif\">"; - EXPECT_CALL(cfd, OnRequestRead(tab_id, request_id, testing::Ge(0))) - .Times(2) - .WillOnce(testing::Invoke(CreateFunctor(&cfd, &MockCFDelegate::ReplyData, - &data))) - .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(&cfd, - &MockCFDelegate::ReplyEOF)))); - - EXPECT_CALL(cfd, OnDidNavigate(tab_id, EqNavigationInfoUrl(GURL(url)))) - .Times(1); - EXPECT_CALL(cfd, OnLoad(tab_id, GURL(url))) - .Times(1); - - // Expect request for logo.gif - request_id++; - EXPECT_CALL(cfd, - OnRequestStart(tab_id, request_id, EqUrlGet(url + "/logo.gif"))) - .Times(1) - .WillOnce(testing::Invoke(CreateFunctor(&cfd, - &MockCFDelegate::Reply404))); - - EXPECT_CALL(cfd, OnRequestRead(tab_id, request_id, testing::_)) - .Times(testing::AtMost(1)); - - // Chrome makes a brave request for favicon.ico - request_id++; - EXPECT_CALL(cfd, - OnRequestStart(tab_id, request_id, EqUrlGet(url + "/favicon.ico"))) - .Times(1) - .WillOnce(testing::Invoke(CreateFunctor(&cfd, - &MockCFDelegate::Reply404))); - - EXPECT_CALL(cfd, OnRequestRead(tab_id, request_id, testing::_)) - .Times(testing::AtMost(1)); - - bool incognito = true; - EXPECT_TRUE(client->Initialize(&cfd, timeout, false, profile, L"", - incognito)); - - loop.RunFor(10); - client->Uninitialize(); - client = NULL; -} - - // [CFAC] -- uses a ProxyFactory for creation of ChromeFrameAutomationProxy // -- uses ChromeFrameAutomationProxy // -- uses TabProxy obtained from ChromeFrameAutomationProxy |