summaryrefslogtreecommitdiffstats
path: root/chrome_frame/test/automation_client_mock.h
diff options
context:
space:
mode:
authormad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-31 14:05:18 +0000
committermad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-31 14:05:18 +0000
commit3592d26e1943c0af9627e8e5a6d01ccf79fbb60c (patch)
tree8314c2e7d9e8e33f70db210a9f7b420e216f0d3f /chrome_frame/test/automation_client_mock.h
parentb9f9935d21ef59f50e46bb4537124a81b840f386 (diff)
downloadchromium_src-3592d26e1943c0af9627e8e5a6d01ccf79fbb60c.zip
chromium_src-3592d26e1943c0af9627e8e5a6d01ccf79fbb60c.tar.gz
chromium_src-3592d26e1943c0af9627e8e5a6d01ccf79fbb60c.tar.bz2
Test the new code for propagating OnChannelError to Chrome Frame Delegate.
The new code was added in: http://src.chromium.org/viewvc/chrome?view=rev&revision=42810 More tests are comming. BUG=0 TEST=none Review URL: http://codereview.chromium.org/1571005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43211 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test/automation_client_mock.h')
-rw-r--r--chrome_frame/test/automation_client_mock.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/chrome_frame/test/automation_client_mock.h b/chrome_frame/test/automation_client_mock.h
index 1d187f3..54f9d5e 100644
--- a/chrome_frame/test/automation_client_mock.h
+++ b/chrome_frame/test/automation_client_mock.h
@@ -32,6 +32,7 @@ struct MockCFDelegate : public ChromeFrameDelegateImpl {
// to the following methods (which we mock)
// MOCK_METHOD1(OnMessageReceived, void(const IPC::Message&));
+ MOCK_METHOD0(OnChannelError, void(void));
MOCK_METHOD2(OnNavigationStateChanged, void(int tab_handle, int flags));
MOCK_METHOD2(OnUpdateTargetUrl, void(int tab_handle,
const std::wstring& new_target_url));
@@ -103,7 +104,6 @@ class MockAutomationProxy : public ChromeFrameAutomationProxy {
struct MockAutomationMessageSender : public AutomationMessageSender {
MOCK_METHOD1(Send, bool(IPC::Message*));
- MOCK_METHOD3(SendWithTimeout, bool(IPC::Message* , int , bool*));
void ForwardTo(StrictMock<MockAutomationProxy> *p) {
proxy_ = p;
@@ -133,7 +133,12 @@ class CFACMockTest : public testing::Test {
MockProxyFactory factory_;
MockCFDelegate cfd_;
chrome_frame_test::TimedMsgLoop loop_;
- StrictMock<MockAutomationProxy> proxy_;
+ // Most of the test uses the mocked proxy, but some tests need
+ // to validate the functionality of the real proxy object.
+ // So we have a mock that is used as the default for the returned_proxy_
+ // pointer, but tests can set their own pointer in there as needed.
+ StrictMock<MockAutomationProxy> mock_proxy_;
+ ChromeFrameAutomationProxy* returned_proxy_;
scoped_ptr<AutomationHandleTracker> tracker_;
MockAutomationMessageSender dummy_sender_;
scoped_refptr<TabProxy> tab_;
@@ -146,7 +151,7 @@ class CFACMockTest : public testing::Test {
int tab_handle_; // Tab handle. Any non-zero value is Ok.
inline ChromeFrameAutomationProxy* get_proxy() {
- return static_cast<ChromeFrameAutomationProxy*>(&proxy_);
+ return returned_proxy_;
}
inline void CreateTab() {
@@ -155,12 +160,13 @@ class CFACMockTest : public testing::Test {
}
// Easy methods to set expectations.
- void SetAutomationServerOk();
+ void SetAutomationServerOk(int times);
void Set_CFD_LaunchFailed(AutomationLaunchResult result);
protected:
CFACMockTest()
: tracker_(NULL), timeout_(500),
+ returned_proxy_(static_cast<ChromeFrameAutomationProxy*>(&mock_proxy_)),
profile_path_(
chrome_frame_test::GetProfilePath(L"Adam.N.Epilinter")) {
id_ = reinterpret_cast<void*>(5);
@@ -168,7 +174,7 @@ class CFACMockTest : public testing::Test {
}
virtual void SetUp() {
- dummy_sender_.ForwardTo(&proxy_);
+ dummy_sender_.ForwardTo(&mock_proxy_);
tracker_.reset(new AutomationHandleTracker());
client_ = new ChromeFrameAutomationClient;