OLD | NEW |
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 #ifndef CHROME_FRAME_TEST_MOCK_WITH_WEB_SERVER_H_ | 4 #ifndef CHROME_FRAME_TEST_MOCK_WITH_WEB_SERVER_H_ |
5 #define CHROME_FRAME_TEST_MOCK_WITH_WEB_SERVER_H_ | 5 #define CHROME_FRAME_TEST_MOCK_WITH_WEB_SERVER_H_ |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "gmock/gmock.h" | 9 #include "gmock/gmock.h" |
10 #include "chrome_frame/chrome_frame_automation.h" | 10 #include "chrome_frame/chrome_frame_automation.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 MOCK_METHOD1(OnLoad, void (const wchar_t* url)); // NOLINT | 68 MOCK_METHOD1(OnLoad, void (const wchar_t* url)); // NOLINT |
69 MOCK_METHOD1(OnLoadError, void (const wchar_t* url)); // NOLINT | 69 MOCK_METHOD1(OnLoadError, void (const wchar_t* url)); // NOLINT |
70 MOCK_METHOD3(OnMessage, void (const wchar_t* message, | 70 MOCK_METHOD3(OnMessage, void (const wchar_t* message, |
71 const wchar_t* origin, | 71 const wchar_t* origin, |
72 const wchar_t* source)); // NOLINT | 72 const wchar_t* source)); // NOLINT |
73 MOCK_METHOD2(OnNewBrowserWindow, void (IDispatch* dispatch, // NOLINT | 73 MOCK_METHOD2(OnNewBrowserWindow, void (IDispatch* dispatch, // NOLINT |
74 const wchar_t* url)); | 74 const wchar_t* url)); |
75 MOCK_METHOD2(OnWindowDetected, void (HWND hwnd, // NOLINT | 75 MOCK_METHOD2(OnWindowDetected, void (HWND hwnd, // NOLINT |
76 const std::string& caption)); | 76 const std::string& caption)); |
77 | 77 |
78 // Test expectations | 78 // Test expectations for general navigations. |
79 ExpectationSet ExpectNavigationCardinality(const std::wstring& url, | 79 ExpectationSet ExpectNavigationCardinality(const std::wstring& url, |
80 testing::Cardinality cardinality); | 80 testing::Cardinality cardinality); |
81 ExpectationSet ExpectNavigation(const std::wstring& url); | 81 ExpectationSet ExpectNavigation(const std::wstring& url); |
82 ExpectationSet ExpectNavigationAndSwitch(const std::wstring& url); | 82 ExpectationSet ExpectNavigationAndSwitch(const std::wstring& url); |
83 ExpectationSet ExpectNavigationAndSwitchSequence(const std::wstring& url); | 83 ExpectationSet ExpectNavigationAndSwitchSequence(const std::wstring& url); |
84 ExpectationSet ExpectNewWindow(MockWebBrowserEventSink* new_window_mock); | 84 ExpectationSet ExpectNewWindow(MockWebBrowserEventSink* new_window_mock); |
85 ExpectationSet MockWebBrowserEventSink::ExpectNavigationSequenceForAnchors( | 85 ExpectationSet ExpectNavigationSequenceForAnchors(const std::wstring& url); |
86 const std::wstring& url); | 86 |
| 87 // Test expectations for navigations with an IE renderer. |
| 88 // Expect one navigation to occur. |
| 89 ExpectationSet ExpectNavigationInIE(const std::wstring& url); |
| 90 // Expect a new window to be opened to |url|. Set |new_window_mock| as the new |
| 91 // window. |
| 92 ExpectationSet ExpectNewWindowWithIE( |
| 93 const std::wstring& url, MockWebBrowserEventSink* new_window_mock); |
87 }; | 94 }; |
88 | 95 |
89 ACTION_P(CloseBrowserMock, mock) { | 96 ACTION_P(CloseBrowserMock, mock) { |
90 mock->CloseWebBrowser(); | 97 mock->CloseWebBrowser(); |
91 } | 98 } |
92 | 99 |
93 ACTION_P(VerifyAddressBarUrl, mock) { | 100 ACTION_P(VerifyAddressBarUrl, mock) { |
94 mock->ExpectAddressBarUrl(std::wstring(arg0)); | 101 mock->ExpectAddressBarUrl(std::wstring(arg0)); |
95 } | 102 } |
96 | 103 |
| 104 ACTION_P4(DelaySendScanCode, loop, delay, c, mod) { |
| 105 loop->PostDelayedTask(FROM_HERE, NewRunnableFunction( |
| 106 simulate_input::SendScanCode, c, mod), delay); |
| 107 } |
| 108 |
97 } // namespace chrome_frame_test | 109 } // namespace chrome_frame_test |
98 | 110 |
99 #endif // CHROME_FRAME_TEST_MOCK_WITH_WEB_SERVER_H_ | 111 #endif // CHROME_FRAME_TEST_MOCK_WITH_WEB_SERVER_H_ |
100 | 112 |
OLD | NEW |