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 // This file provides reliablity tests which run for ChromeFrame. | 5 // This file provides reliablity tests which run for ChromeFrame. |
6 // | 6 // |
7 // Usage: | 7 // Usage: |
8 // <reliability test exe> --list=file --startline=start --endline=end [...] | 8 // <reliability test exe> --list=file --startline=start --endline=end [...] |
9 // Upon invocation, it visits each of the URLs on line numbers between start | 9 // Upon invocation, it visits each of the URLs on line numbers between start |
10 // and end, inclusive, stored in the input file. The line number starts from 1. | 10 // and end, inclusive, stored in the input file. The line number starts from 1. |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 EXPECT_HRESULT_SUCCEEDED(hr); | 190 EXPECT_HRESULT_SUCCEEDED(hr); |
191 EXPECT_TRUE(web_browser2.get() != NULL); | 191 EXPECT_TRUE(web_browser2.get() != NULL); |
192 web_browser2->put_Visible(VARIANT_TRUE); | 192 web_browser2->put_Visible(VARIANT_TRUE); |
193 | 193 |
194 // Log Browser Launched time. | 194 // Log Browser Launched time. |
195 time_now = base::Time::Now(); | 195 time_now = base::Time::Now(); |
196 test_log << "browser_launched_seconds="; | 196 test_log << "browser_launched_seconds="; |
197 test_log << (time_now.ToDoubleT() - time_start) << std::endl; | 197 test_log << (time_now.ToDoubleT() - time_start) << std::endl; |
198 | 198 |
199 bool is_chrome_frame_navigation = | 199 bool is_chrome_frame_navigation = |
200 StartsWith(UTF8ToWide(url.spec()), kChromeProtocolPrefix, true); | 200 StartsWith(base::UTF8ToWide(url.spec()), kChromeProtocolPrefix, true); |
201 | 201 |
202 CComObjectStack<chrome_frame_test::IEEventSink> ie_event_sink; | 202 CComObjectStack<chrome_frame_test::IEEventSink> ie_event_sink; |
203 MockLoadListener load_listener; | 203 MockLoadListener load_listener; |
204 // Disregard any interstitial about:blank loads. | 204 // Disregard any interstitial about:blank loads. |
205 EXPECT_CALL(load_listener, OnDocumentComplete(StrCaseEq(L"about:blank"))) | 205 EXPECT_CALL(load_listener, OnDocumentComplete(StrCaseEq(L"about:blank"))) |
206 .Times(testing::AnyNumber()); | 206 .Times(testing::AnyNumber()); |
207 | 207 |
208 // Note that we can't compare the loaded url directly with the given url | 208 // Note that we can't compare the loaded url directly with the given url |
209 // because the page may have redirected us to a different page, e.g. | 209 // because the page may have redirected us to a different page, e.g. |
210 // www.google.com -> www.google.ca. | 210 // www.google.com -> www.google.ca. |
211 if (is_chrome_frame_navigation) { | 211 if (is_chrome_frame_navigation) { |
212 EXPECT_CALL(load_listener, OnDocumentComplete(testing::_)); | 212 EXPECT_CALL(load_listener, OnDocumentComplete(testing::_)); |
213 EXPECT_CALL(load_listener, OnLoad(testing::_)) | 213 EXPECT_CALL(load_listener, OnLoad(testing::_)) |
214 .WillOnce(QuitIE(&ie_event_sink)); | 214 .WillOnce(QuitIE(&ie_event_sink)); |
215 } else { | 215 } else { |
216 EXPECT_CALL(load_listener, OnDocumentComplete(StrCaseNe(L"about:blank"))) | 216 EXPECT_CALL(load_listener, OnDocumentComplete(StrCaseNe(L"about:blank"))) |
217 .WillOnce(QuitIE(&ie_event_sink)); | 217 .WillOnce(QuitIE(&ie_event_sink)); |
218 } | 218 } |
219 EXPECT_CALL(load_listener, OnQuit()).WillOnce(QUIT_LOOP(message_loop)); | 219 EXPECT_CALL(load_listener, OnQuit()).WillOnce(QUIT_LOOP(message_loop)); |
220 | 220 |
221 // Attach the sink and navigate. | 221 // Attach the sink and navigate. |
222 ie_event_sink.set_listener(&load_listener); | 222 ie_event_sink.set_listener(&load_listener); |
223 ie_event_sink.Attach(web_browser2); | 223 ie_event_sink.Attach(web_browser2); |
224 hr = ie_event_sink.Navigate(UTF8ToWide(url.spec())); | 224 hr = ie_event_sink.Navigate(base::UTF8ToWide(url.spec())); |
225 if (SUCCEEDED(hr)) { | 225 if (SUCCEEDED(hr)) { |
226 message_loop.RunFor(base::TimeDelta::FromSeconds(g_timeout_seconds)); | 226 message_loop.RunFor(base::TimeDelta::FromSeconds(g_timeout_seconds)); |
227 if (!message_loop.WasTimedOut()) | 227 if (!message_loop.WasTimedOut()) |
228 metrics.result = NAVIGATION_SUCCESS; | 228 metrics.result = NAVIGATION_SUCCESS; |
229 } | 229 } |
230 | 230 |
231 // Log navigate complete time. | 231 // Log navigate complete time. |
232 time_now = base::Time::Now(); | 232 time_now = base::Time::Now(); |
233 test_log << "navigate_complete_seconds="; | 233 test_log << "navigate_complete_seconds="; |
234 test_log << (time_now.ToDoubleT() - time_start) << std::endl; | 234 test_log << (time_now.ToDoubleT() - time_start) << std::endl; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 std::string url_str; | 310 std::string url_str; |
311 std::getline(file, url_str); | 311 std::getline(file, url_str); |
312 | 312 |
313 if (file.fail()) { | 313 if (file.fail()) { |
314 break; | 314 break; |
315 } | 315 } |
316 | 316 |
317 // Every 3rd URL goes into the host browser. | 317 // Every 3rd URL goes into the host browser. |
318 if (line_index % 3 != 0) { | 318 if (line_index % 3 != 0) { |
319 std::string actual_url; | 319 std::string actual_url; |
320 actual_url = WideToUTF8(kChromeProtocolPrefix); | 320 actual_url = base::WideToUTF8(kChromeProtocolPrefix); |
321 actual_url += url_str; | 321 actual_url += url_str; |
322 url_str = actual_url; | 322 url_str = actual_url; |
323 } | 323 } |
324 | 324 |
325 if (g_start_index <= line_index) { | 325 if (g_start_index <= line_index) { |
326 NavigateToURLLogResult(url_str, log_file, NULL); | 326 NavigateToURLLogResult(url_str, log_file, NULL); |
327 } | 327 } |
328 } | 328 } |
329 | 329 |
330 file.close(); | 330 file.close(); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 CommandLine v8_command_line( | 592 CommandLine v8_command_line( |
593 parsed_command_line.GetSwitchValuePath(switches::kJavaScriptFlags)); | 593 parsed_command_line.GetSwitchValuePath(switches::kJavaScriptFlags)); |
594 if (v8_command_line.HasSwitch(kV8LogFileSwitch)) { | 594 if (v8_command_line.HasSwitch(kV8LogFileSwitch)) { |
595 g_v8_log_path = base::MakeAbsoluteFilePath( | 595 g_v8_log_path = base::MakeAbsoluteFilePath( |
596 v8_command_line.GetSwitchValuePath(kV8LogFileSwitch)); | 596 v8_command_line.GetSwitchValuePath(kV8LogFileSwitch)); |
597 } | 597 } |
598 } | 598 } |
599 } | 599 } |
600 } | 600 } |
601 } | 601 } |
OLD | NEW |