OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 4 |
5 #ifndef CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_TEST_H_ | 5 #ifndef CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_TEST_H_ |
6 #define CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_TEST_H_ | 6 #define CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_TEST_H_ |
7 | 7 |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlcom.h> | 9 #include <atlcom.h> |
10 #include <string> | 10 #include <string> |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 }; | 271 }; |
272 | 272 |
273 // This test fixture provides common methods needed for testing CF | 273 // This test fixture provides common methods needed for testing CF |
274 // integration with IE. gMock is used to verify that IE is reporting correct | 274 // integration with IE. gMock is used to verify that IE is reporting correct |
275 // navigational events and MockWebServer is used to verify that the correct | 275 // navigational events and MockWebServer is used to verify that the correct |
276 // requests are going out. | 276 // requests are going out. |
277 class MockIEEventSinkTest { | 277 class MockIEEventSinkTest { |
278 public: | 278 public: |
279 MockIEEventSinkTest(); | 279 MockIEEventSinkTest(); |
280 MockIEEventSinkTest(int port, const std::wstring& address, | 280 MockIEEventSinkTest(int port, const std::wstring& address, |
281 const FilePath& root_dir); | 281 const base::FilePath& root_dir); |
282 | 282 |
283 ~MockIEEventSinkTest() { | 283 ~MockIEEventSinkTest() { |
284 // Detach manually here so that it occurs before |last_resort_close_ie_| | 284 // Detach manually here so that it occurs before |last_resort_close_ie_| |
285 // is destroyed. | 285 // is destroyed. |
286 ie_mock_.Detach(); | 286 ie_mock_.Detach(); |
287 } | 287 } |
288 | 288 |
289 // Launches IE as a COM server and sets |ie_mock_| as the event sink, then | 289 // Launches IE as a COM server and sets |ie_mock_| as the event sink, then |
290 // navigates to the given url. Then the timed message loop is run until | 290 // navigates to the given url. Then the timed message loop is run until |
291 // |ie_mock_| receives OnQuit or the timeout is exceeded. | 291 // |ie_mock_| receives OnQuit or the timeout is exceeded. |
292 void LaunchIEAndNavigate(const std::wstring& url); | 292 void LaunchIEAndNavigate(const std::wstring& url); |
293 | 293 |
294 // Same as above but allows the timeout to be specified. | 294 // Same as above but allows the timeout to be specified. |
295 void LaunchIENavigateAndLoop(const std::wstring& url, | 295 void LaunchIENavigateAndLoop(const std::wstring& url, |
296 base::TimeDelta timeout); | 296 base::TimeDelta timeout); |
297 | 297 |
298 // Returns the url for the test file given. |relative_path| should be | 298 // Returns the url for the test file given. |relative_path| should be |
299 // relative to the test data directory. | 299 // relative to the test data directory. |
300 std::wstring GetTestUrl(const std::wstring& relative_path); | 300 std::wstring GetTestUrl(const std::wstring& relative_path); |
301 | 301 |
302 // Returns the absolute FilePath for the test file given. |relative_path| | 302 // Returns the absolute FilePath for the test file given. |relative_path| |
303 // should be relative to the test data directory. | 303 // should be relative to the test data directory. |
304 FilePath GetTestFilePath(const std::wstring& relative_path); | 304 base::FilePath GetTestFilePath(const std::wstring& relative_path); |
305 | 305 |
306 // Returns the url for an html page just containing some text. Iff |use_cf| | 306 // Returns the url for an html page just containing some text. Iff |use_cf| |
307 // is true, the chrome_frame meta tag will be included too. | 307 // is true, the chrome_frame meta tag will be included too. |
308 std::wstring GetSimplePageUrl() { | 308 std::wstring GetSimplePageUrl() { |
309 return GetTestUrl(L"simple.html"); | 309 return GetTestUrl(L"simple.html"); |
310 } | 310 } |
311 | 311 |
312 // Returns the title of the html page at |GetSimplePageUrl()|. | 312 // Returns the title of the html page at |GetSimplePageUrl()|. |
313 std::wstring GetSimplePageTitle() { | 313 std::wstring GetSimplePageTitle() { |
314 return L"simple web page"; | 314 return L"simple web page"; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 testing::StrictMock<MockIEEventSink> ie_mock_; | 359 testing::StrictMock<MockIEEventSink> ie_mock_; |
360 testing::StrictMock<MockWebServer> server_mock_; | 360 testing::StrictMock<MockWebServer> server_mock_; |
361 scoped_refptr<HungCOMCallDetector> hung_call_detector_; | 361 scoped_refptr<HungCOMCallDetector> hung_call_detector_; |
362 private: | 362 private: |
363 DISALLOW_COPY_AND_ASSIGN(MockIEEventSinkTest); | 363 DISALLOW_COPY_AND_ASSIGN(MockIEEventSinkTest); |
364 }; | 364 }; |
365 | 365 |
366 } // namespace chrome_frame_test | 366 } // namespace chrome_frame_test |
367 | 367 |
368 #endif // CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_TEST_H_ | 368 #endif // CHROME_FRAME_TEST_MOCK_IE_EVENT_SINK_TEST_H_ |
OLD | NEW |