| 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 #include "chrome_frame/test/mock_ie_event_sink_test.h" | 5 #include "chrome_frame/test/mock_ie_event_sink_test.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/win/scoped_variant.h" | 10 #include "base/win/scoped_variant.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 } | 185 } |
| 186 | 186 |
| 187 MockIEEventSinkTest::MockIEEventSinkTest(int port, const std::wstring& address, | 187 MockIEEventSinkTest::MockIEEventSinkTest(int port, const std::wstring& address, |
| 188 const FilePath& root_dir) | 188 const FilePath& root_dir) |
| 189 : server_mock_(port, address, root_dir) { | 189 : server_mock_(port, address, root_dir) { |
| 190 EXPECT_CALL(server_mock_, Get(_, StrCaseEq(L"/favicon.ico"), _)) | 190 EXPECT_CALL(server_mock_, Get(_, StrCaseEq(L"/favicon.ico"), _)) |
| 191 .WillRepeatedly(SendFast("HTTP/1.1 404 Not Found", "")); | 191 .WillRepeatedly(SendFast("HTTP/1.1 404 Not Found", "")); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void MockIEEventSinkTest::LaunchIEAndNavigate(const std::wstring& url) { | 194 void MockIEEventSinkTest::LaunchIEAndNavigate(const std::wstring& url) { |
| 195 LaunchIENavigateAndLoop(url, kChromeFrameLongNavigationTimeoutInSeconds); | 195 LaunchIENavigateAndLoop(url, kChromeFrameLongNavigationTimeout); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void MockIEEventSinkTest::LaunchIENavigateAndLoop(const std::wstring& url, | 198 void MockIEEventSinkTest::LaunchIENavigateAndLoop(const std::wstring& url, |
| 199 int timeout) { | 199 base::TimeDelta timeout) { |
| 200 if (GetInstalledIEVersion() >= IE_8) { | 200 if (GetInstalledIEVersion() >= IE_8) { |
| 201 chrome_frame_test::ClearIESessionHistory(); | 201 chrome_frame_test::ClearIESessionHistory(); |
| 202 } | 202 } |
| 203 hung_call_detector_ = HungCOMCallDetector::Setup(timeout); | 203 hung_call_detector_ = HungCOMCallDetector::Setup(ceil(timeout.InSecondsF())); |
| 204 EXPECT_TRUE(hung_call_detector_ != NULL); | 204 EXPECT_TRUE(hung_call_detector_ != NULL); |
| 205 | 205 |
| 206 IEEventSink::SetAbnormalShutdown(false); | 206 IEEventSink::SetAbnormalShutdown(false); |
| 207 | 207 |
| 208 EXPECT_CALL(ie_mock_, OnQuit()) | 208 EXPECT_CALL(ie_mock_, OnQuit()) |
| 209 .WillOnce(QUIT_LOOP(loop_)); | 209 .WillOnce(QUIT_LOOP(loop_)); |
| 210 | 210 |
| 211 HRESULT hr = ie_mock_.event_sink()->LaunchIEAndNavigate(url, &ie_mock_); | 211 HRESULT hr = ie_mock_.event_sink()->LaunchIEAndNavigate(url, &ie_mock_); |
| 212 ASSERT_HRESULT_SUCCEEDED(hr); | 212 ASSERT_HRESULT_SUCCEEDED(hr); |
| 213 if (hr != S_FALSE) { | 213 if (hr != S_FALSE) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 225 const std::wstring& relative_path) { | 225 const std::wstring& relative_path) { |
| 226 return server_mock_.root_dir().Append(relative_path); | 226 return server_mock_.root_dir().Append(relative_path); |
| 227 } | 227 } |
| 228 | 228 |
| 229 std::wstring MockIEEventSinkTest::GetTestUrl( | 229 std::wstring MockIEEventSinkTest::GetTestUrl( |
| 230 const std::wstring& relative_path) { | 230 const std::wstring& relative_path) { |
| 231 return server_mock_.Resolve(relative_path.c_str()); | 231 return server_mock_.Resolve(relative_path.c_str()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 } // namespace chrome_frame_test | 234 } // namespace chrome_frame_test |
| OLD | NEW |