summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-19 07:27:27 +0000
committerstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-19 07:27:27 +0000
commit5c34e39cea9e91fda04224aa7f5cb490fd5fb0c4 (patch)
treeb30014e7c4d4f4be968ee4fa358948c0aa8739e1
parent12ea22a1337a63db017338156ba56abd62beacbd (diff)
downloadchromium_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
-rw-r--r--chrome/test/automation/automation_proxy_uitest.cc187
-rw-r--r--chrome/test/automation/automation_proxy_uitest.h4
-rw-r--r--chrome/test/ui/ui_test.cc4
-rw-r--r--chrome/test/ui/ui_test.h4
-rw-r--r--chrome/test/ui_test_utils.cc6
-rw-r--r--chrome/test/ui_test_utils.h7
-rw-r--r--chrome_frame/test/chrome_frame_unittests.cc135
7 files changed, 180 insertions, 167 deletions
diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc
index 511219d..bbfb8d2 100644
--- a/chrome/test/automation/automation_proxy_uitest.cc
+++ b/chrome/test/automation/automation_proxy_uitest.cc
@@ -36,6 +36,7 @@
using ui_test_utils::TimedMessageLoopRunner;
using testing::CreateFunctor;
+using testing::StrEq;
#if defined(OS_MACOSX)
#define MAYBE_WindowGetViewBounds DISABLED_WindowGetViewBounds
@@ -873,12 +874,52 @@ class ExternalTabUITestMockClient : public AutomationProxy {
MOCK_METHOD4(OnForwardMessageToExternalHost, void(int handle,
const std::string& message, const std::string& origin,
const std::string& target));
+ MOCK_METHOD3(OnRequestStart, void(int tab_handle, int request_id,
+ const IPC::AutomationURLRequest& request));
+ MOCK_METHOD3(OnRequestRead, void(int tab_handle, int request_id,
+ int bytes_to_read));
+ MOCK_METHOD3(OnRequestEnd, void(int tab_handle, int request_id,
+ const URLRequestStatus& status));
+ MOCK_METHOD3(OnSetCookieAsync, void(int tab_handle, const GURL& url,
+ const std::string& cookie));
+
+
MOCK_METHOD1(HandleClosed, void(int handle));
- scoped_refptr<TabProxy> CreateTabWithHostWindow(
- bool is_incognito, const GURL& initial_url);
+
+ // Action helpers for OnRequest* incoming messages. Create the message and
+ // delegate sending to the base class. Apparently we do not have wrappers
+ // in AutomationProxy for these messages.
+ void ReplyStarted(const IPC::AutomationURLResponse* response,
+ int tab_handle, int request_id) {
+ AutomationProxy::Send(new AutomationMsg_RequestStarted(0, tab_handle,
+ request_id, *response));
+ }
+
+ void ReplyData(const std::string* data, int tab_handle, int request_id) {
+ AutomationProxy::Send(new AutomationMsg_RequestData(0, tab_handle,
+ request_id, *data));
+ }
+
+ void ReplyEOF(int tab_handle, int request_id) {
+ AutomationProxy::Send(new AutomationMsg_RequestEnd(0, tab_handle,
+ request_id,
+ URLRequestStatus()));
+ }
+
+ void Reply404(int tab_handle, int request_id) {
+ const IPC::AutomationURLResponse notfound = {"", "HTTP/1.1 404\r\n\r\n"};
+ ReplyStarted(&notfound, tab_handle, request_id);
+ ReplyEOF(tab_handle, request_id);
+ }
+
+ // Test setup helpers
+ scoped_refptr<TabProxy> CreateHostWindowAndTab(
+ const IPC::ExternalTabSettings& settings);
+ scoped_refptr<TabProxy> CreateTabWithUrl(const GURL& initial_url);
void DestroyHostWindow();
+ static const IPC::ExternalTabSettings default_settings;
protected:
HWND host_window_;
@@ -895,40 +936,48 @@ class ExternalTabUITestMockClient : public AutomationProxy {
}
};
+// Most of the time we need external tab with these settings.
+const IPC::ExternalTabSettings ExternalTabUITestMockClient::default_settings = {
+ NULL, gfx::Rect(), // will be replaced by CreateHostWindowAndTab
+ WS_CHILD | WS_VISIBLE,
+ false, // is_off_the_record
+ true, // load_requests_via_automation
+ true, // handle_top_level_requests
+ GURL() // initial_url
+};
+
void ExternalTabUITestMockClient::OnMessageReceived(const IPC::Message& msg) {
IPC_BEGIN_MESSAGE_MAP(ExternalTabUITestMockClient, msg)
IPC_MESSAGE_HANDLER(AutomationMsg_DidNavigate, OnDidNavigate)
IPC_MESSAGE_HANDLER(AutomationMsg_ForwardMessageToExternalHost,
- OnForwardMessageToExternalHost)
+ OnForwardMessageToExternalHost)
+ IPC_MESSAGE_HANDLER(AutomationMsg_RequestStart, OnRequestStart)
+ IPC_MESSAGE_HANDLER(AutomationMsg_RequestRead, OnRequestRead)
+ IPC_MESSAGE_HANDLER(AutomationMsg_RequestEnd, OnRequestEnd)
+ IPC_MESSAGE_HANDLER(AutomationMsg_SetCookieAsync, OnSetCookieAsync)
IPC_END_MESSAGE_MAP()
}
-scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateTabWithHostWindow(
- bool is_incognito, const GURL& initial_url) {
+scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateHostWindowAndTab(
+ const IPC::ExternalTabSettings& settings) {
+ EXPECT_THAT(settings.parent, testing::IsNull());
DWORD style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
host_window_ = CreateWindowW(L"Static", NULL, style,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, NULL, NULL);
-
EXPECT_THAT(host_window_, testing::Truly(::IsWindow));
-
+ // TODO(stoyan): Uncomment when we teach UITest to have MessageLoopForUI.
+ // ::ShowWindow(host_window_, SW_SHOW);
RECT client_area = {0};
::GetClientRect(host_window_, &client_area);
- const IPC::ExternalTabSettings settings = {
- host_window_,
- gfx::Rect(client_area),
- WS_CHILD | WS_VISIBLE,
- is_incognito,
- false,
- false,
- initial_url
- };
+ IPC::ExternalTabSettings s = settings;
+ s.parent = host_window_;
+ s.dimensions = client_area;
HWND container_wnd = NULL;
HWND tab_wnd = NULL;
- scoped_refptr<TabProxy> tab(CreateExternalTab(settings, &container_wnd,
- &tab_wnd));
+ scoped_refptr<TabProxy> tab(CreateExternalTab(s, &container_wnd, &tab_wnd));
EXPECT_TRUE(tab != NULL);
EXPECT_NE(FALSE, ::IsWindow(container_wnd));
@@ -936,6 +985,14 @@ scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateTabWithHostWindow(
return tab;
}
+scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateTabWithUrl(
+ const GURL& initial_url) {
+ IPC::ExternalTabSettings settings =
+ ExternalTabUITestMockClient::default_settings;
+ settings.initial_url = initial_url;
+ return CreateHostWindowAndTab(settings);
+}
+
void ExternalTabUITestMockClient::DestroyHostWindow() {
::DestroyWindow(host_window_);
}
@@ -974,7 +1031,7 @@ TEST_F(ExternalTabUITest, CreateExternalTab1) {
.Times(1)
.WillOnce(QUIT_LOOP(&loop));
- tab = mock_->CreateTabWithHostWindow(false, GURL(simple_data_url));
+ tab = mock_->CreateTabWithUrl(GURL(simple_data_url));
loop.RunFor(2 * action_max_timeout_ms());
}
@@ -993,7 +1050,7 @@ TEST_F(ExternalTabUITest, CreateExternalTab2) {
.Times(1)
.WillOnce(QUIT_LOOP(&loop));
- tab = mock_->CreateTabWithHostWindow(false, GURL());
+ tab = mock_->CreateTabWithUrl(GURL());
tab->NavigateInExternalTab(GURL(simple_data_url), GURL());
loop.RunFor(2 * action_max_timeout_ms());
}
@@ -1003,13 +1060,24 @@ TEST_F(ExternalTabUITest, IncognitoMode) {
TimedMessageLoopRunner loop(MessageLoop::current());
ASSERT_THAT(mock_, testing::NotNull());
-
GURL url("http://anatomyofmelancholy.net");
- tab = mock_->CreateTabWithHostWindow(true, GURL());
+ std::string cookie = "robert=burton; expires=Thu, 13 Oct 2011 05:04:03 UTC;";
+
+ EXPECT_CALL(*mock_, OnSetCookieAsync(1, url, StrEq(cookie)))
+ .Times(1)
+ .WillOnce(QUIT_LOOP(&loop));
+ EXPECT_CALL(*mock_, HandleClosed(1)).Times(1);
+
+ IPC::ExternalTabSettings incognito =
+ ExternalTabUITestMockClient::default_settings;
+ incognito.is_off_the_record = true;
+ tab = mock_->CreateHostWindowAndTab(incognito);
std::string value_result;
- EXPECT_TRUE(tab->SetCookie(url, "robert=burton; "
- "expires=Thu, 13 Oct 2011 05:04:03 UTC;"));
+ EXPECT_TRUE(tab->SetCookie(url, cookie));
+ loop.RunFor(action_max_timeout_ms());
+ ASSERT_FALSE(loop.WasTimedOut()); // Expect QuitLoop from OnSetCookieAsync.
+
EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result));
EXPECT_EQ("burton", value_result);
mock_->DestroyHostWindow();
@@ -1019,7 +1087,7 @@ TEST_F(ExternalTabUITest, IncognitoMode) {
value_result.clear();
clear_profile_ = false;
LaunchBrowserAndServer();
- tab = mock_->CreateTabWithHostWindow(false, GURL());
+ tab = mock_->CreateTabWithUrl(GURL());
EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result));
EXPECT_EQ("", value_result);
}
@@ -1055,7 +1123,7 @@ TEST_F(ExternalTabUITest, TabPostMessage) {
.WillOnce(QUIT_LOOP_SOON(&loop, 50));
- tab = mock_->CreateTabWithHostWindow(false, GURL(content));
+ tab = mock_->CreateTabWithUrl(GURL(content));
loop.RunFor(2 * action_max_timeout_ms());
}
@@ -1086,12 +1154,75 @@ TEST_F(ExternalTabUITest, FLAKY_PostMessageTarget) {
.Times(1)
.WillOnce(QUIT_LOOP_SOON(&loop, 50));
+ IPC::ExternalTabSettings s = ExternalTabUITestMockClient::default_settings;
+ s.load_requests_via_automation = false;
+ s.initial_url = GURL("http://localhost:1337/files/post_message.html");
+ tab = mock_->CreateHostWindowAndTab(s);
+ loop.RunFor(2 * action_max_timeout_ms());
+}
+
+TEST_F(ExternalTabUITest, HostNetworkStack) {
+ scoped_refptr<TabProxy> tab;
+ TimedMessageLoopRunner loop(MessageLoop::current());
+ ASSERT_THAT(mock_, testing::NotNull());
- tab = mock_->CreateTabWithHostWindow(false,
- GURL("http://localhost:1337/files/post_message.html"));
+ std::string url = "http://placetogo.org";
+ const IPC::AutomationURLResponse http_200 = {"", "HTTP/0.9 200\r\n\r\n", };
+ testing::InSequence sequence;
+ EXPECT_CALL(*mock_, OnRequestStart(1, 2, testing::AllOf(
+ testing::Field(&IPC::AutomationURLRequest::url, StrEq(url + "/")),
+ testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET")))))
+ .Times(1)
+ // We can simply do CreateFunctor(1, 2, &http_200) since we know the
+ // tab handle and request id, but using WithArgs<> is much more fancy :)
+ .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_,
+ &ExternalTabUITestMockClient::ReplyStarted, &http_200))));
+
+ // 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(*mock_, OnRequestRead(1, 2, testing::Gt(0)))
+ .Times(2)
+ .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_,
+ &ExternalTabUITestMockClient::ReplyData, &data, 1, 2)))
+ .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_,
+ &ExternalTabUITestMockClient::ReplyEOF))));
+
+ // Expect navigation is ok.
+ EXPECT_CALL(*mock_, OnDidNavigate(1, testing::Field(&IPC::NavigationInfo::url,
+ GURL(url))))
+ .Times(1);
+
+ // Expect GET request for logo.gif
+ EXPECT_CALL(*mock_, OnRequestStart(1, 3, testing::AllOf(
+ testing::Field(&IPC::AutomationURLRequest::url, StrEq(url + "/logo.gif")),
+ testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET")))))
+ .Times(1)
+ .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_,
+ &ExternalTabUITestMockClient::Reply404, 1, 3)));
+ EXPECT_CALL(*mock_, OnRequestRead(1, 3, testing::Gt(0)))
+ .Times(1);
+
+
+ // Chrome makes a brave request for favicon.ico
+ EXPECT_CALL(*mock_, OnRequestStart(1, 4, testing::AllOf(
+ testing::Field(&IPC::AutomationURLRequest::url,
+ StrEq(url + "/favicon.ico")),
+ testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET")))))
+ .Times(1)
+ .WillOnce(testing::DoAll(
+ testing::InvokeWithoutArgs(CreateFunctor(mock_,
+ &ExternalTabUITestMockClient::Reply404, 1, 4)),
+ QUIT_LOOP_SOON(&loop, 300)));
+ EXPECT_CALL(*mock_, OnRequestRead(1, 4, testing::Gt(0)))
+ .Times(1);
+
+ tab = mock_->CreateTabWithUrl(GURL(url));
loop.RunFor(2 * action_max_timeout_ms());
}
+
#endif // defined(OS_WIN)
// TODO(port): Need to port autocomplete_edit_proxy.* first.
diff --git a/chrome/test/automation/automation_proxy_uitest.h b/chrome/test/automation/automation_proxy_uitest.h
index 3affb89..7fa1a2b 100644
--- a/chrome/test/automation/automation_proxy_uitest.h
+++ b/chrome/test/automation/automation_proxy_uitest.h
@@ -25,6 +25,10 @@ class ExternalTabUITest : public UITest {
// This function is called from within UITest::LaunchBrowserAndServer.
virtual AutomationProxy* CreateAutomationProxy(int execution_timeout);
protected:
+ // Filtered Inet will override automation callbacks for network resources.
+ virtual bool ShouldFilterInet() {
+ return false;
+ }
ExternalTabUITestMockClient* mock_;
};
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index e9ca10e..f2cbd37 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -166,7 +166,7 @@ void UITest::TearDown() {
PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_path);
// Each crash creates two dump files, so we divide by two here.
int actual_crashes =
- file_util::CountFilesCreatedAfter(crash_dump_path, test_start_time_) / 2;
+ file_util::CountFilesCreatedAfter(crash_dump_path, test_start_time_) / 2;
std::wstring error_msg =
L"Encountered an unexpected crash in the program during this test.";
if (expected_crashes_ > 0 && actual_crashes == 0) {
@@ -230,7 +230,7 @@ void UITest::LaunchBrowserAndServer() {
else
PlatformThread::Sleep(sleep_timeout_ms());
- automation()->SetFilteredInet(true);
+ automation()->SetFilteredInet(ShouldFilterInet());
}
void UITest::CloseBrowserAndServer() {
diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h
index 165d9e5..6a14359 100644
--- a/chrome/test/ui/ui_test.h
+++ b/chrome/test/ui/ui_test.h
@@ -473,6 +473,10 @@ class UITest : public testing::Test {
return server_.get();
}
+ virtual bool ShouldFilterInet() {
+ return true;
+ }
+
// Wait a certain amount of time for all the app processes to exit,
// forcibly killing them if they haven't exited by then.
// It has the side-effect of killing every browser window opened in your
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc
index 8da3db3..6723084 100644
--- a/chrome/test/ui_test_utils.cc
+++ b/chrome/test/ui_test_utils.cc
@@ -505,7 +505,8 @@ void RegisterAndWait(NotificationType::Type type,
TimedMessageLoopRunner::TimedMessageLoopRunner()
: loop_(new MessageLoopForUI()),
- owned_(true) {
+ owned_(true),
+ quit_loop_invoked_(false) {
}
TimedMessageLoopRunner::~TimedMessageLoopRunner() {
@@ -515,14 +516,17 @@ TimedMessageLoopRunner::~TimedMessageLoopRunner() {
void TimedMessageLoopRunner::RunFor(int ms) {
QuitAfter(ms);
+ quit_loop_invoked_ = false;
loop_->Run();
}
void TimedMessageLoopRunner::Quit() {
+ quit_loop_invoked_ = true;
loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask);
}
void TimedMessageLoopRunner::QuitAfter(int ms) {
+ quit_loop_invoked_ = true;
loop_->PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask, ms);
}
diff --git a/chrome/test/ui_test_utils.h b/chrome/test/ui_test_utils.h
index c7cab8c..89dc8fc 100644
--- a/chrome/test/ui_test_utils.h
+++ b/chrome/test/ui_test_utils.h
@@ -144,7 +144,7 @@ class TimedMessageLoopRunner {
// Attach to an existing message loop.
explicit TimedMessageLoopRunner(MessageLoop* loop)
- : loop_(loop), owned_(false) {}
+ : loop_(loop), owned_(false), quit_loop_invoked_(false) {}
~TimedMessageLoopRunner();
@@ -157,9 +157,14 @@ class TimedMessageLoopRunner {
// Post delayed Quit task to the message loop.
void QuitAfter(int ms);
+ bool WasTimedOut() const {
+ return !quit_loop_invoked_;
+ }
+
private:
MessageLoop* loop_;
bool owned_;
+ bool quit_loop_invoked_;
DISALLOW_COPY_AND_ASSIGN(TimedMessageLoopRunner);
};
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