summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-12 19:47:18 +0000
committerstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-12 19:47:18 +0000
commit138dc7d4cc38e99869fc9227686ebbdf59de119f (patch)
tree1c8553f3b3ca28fd6e355902b291594389b74b17 /chrome_frame
parent77dccd23537a7e101d5564c4df4f60d3b716a8b2 (diff)
downloadchromium_src-138dc7d4cc38e99869fc9227686ebbdf59de119f.zip
chromium_src-138dc7d4cc38e99869fc9227686ebbdf59de119f.tar.gz
chromium_src-138dc7d4cc38e99869fc9227686ebbdf59de119f.tar.bz2
Test for ChannelError for Chrome Frame Proxy.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62322 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/cfproxy_test.cc41
1 files changed, 41 insertions, 0 deletions
diff --git a/chrome_frame/cfproxy_test.cc b/chrome_frame/cfproxy_test.cc
index e2de08f..28ba8c6 100644
--- a/chrome_frame/cfproxy_test.cc
+++ b/chrome_frame/cfproxy_test.cc
@@ -247,6 +247,47 @@ TEST(ChromeProxy, LaunchChrome) {
factory.ReleaseProxy(&delegate, params.profile);
}
+// Test that a channel error results in Completed_XYZ(false, ) called if
+// the synchronious XYZ message has been sent.
+TEST(ChromeProxy, ChannelError) {
+ base::WaitableEvent connected(false, false);
+ StrictMock<MockCFProxyTraits> api;
+ StrictMock<MockChromeProxyDelegate> delegate;
+ StrictMock<MockFactory> factory;
+ CFProxy* proxy = new CFProxy(&api);
+
+ ProxyParams params;
+ params.profile = "Adam N. Epilinter";
+ params.timeout = base::TimeDelta::FromMilliseconds(300);
+
+ testing::InSequence s;
+
+ EXPECT_CALL(factory, CreateProxy()).WillOnce(Return(proxy));
+ EXPECT_CALL(api, DoCreateChannel(_, proxy)).WillOnce(Return(&api.sender));
+ EXPECT_CALL(api, LaunchApp(_)).WillOnce(DoAll(
+ API_FIRE_CONNECT(api, base::TimeDelta::FromMilliseconds(10)),
+ Return(true)));
+ EXPECT_CALL(delegate, Connected(proxy))
+ .WillOnce(DoAll(
+ InvokeWithoutArgs(CreateFunctor(proxy, &ChromeProxy::ConnectTab,
+ &delegate, HWND(6), 512)),
+ InvokeWithoutArgs(&connected, &base::WaitableEvent::Signal)));
+
+ EXPECT_CALL(api.sender, Send(_));
+ EXPECT_CALL(delegate, Completed_ConnectToTab(false, _, _, _));
+ EXPECT_CALL(api, CloseChannel(&api.sender));
+ EXPECT_CALL(delegate, PeerLost(_, ChromeProxyDelegate::CHANNEL_ERROR));
+
+ factory.GetProxy(&delegate, params);
+ EXPECT_TRUE(connected.TimedWait(base::TimeDelta::FromSeconds(15)));
+ // Simulate a channel error.
+ api.FireError(base::TimeDelta::FromMilliseconds(0));
+
+ // Expectations when the Proxy is destroyed.
+ EXPECT_CALL(delegate, tab_handle()).WillOnce(Return(0));
+ EXPECT_CALL(delegate, Disconnected());
+ factory.ReleaseProxy(&delegate, params.profile);
+}
///////////////////////////////////////////////////////////////////////////////
namespace {
template <typename M, typename A>