| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 | 4 |
| 5 #include <mshtmcid.h> | 5 #include <mshtmcid.h> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/test/test_file_util.h" | 8 #include "base/test/test_file_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/win/scoped_bstr.h" | 10 #include "base/win/scoped_bstr.h" |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 bool in_cf = GetParam().invokes_cf(); | 262 bool in_cf = GetParam().invokes_cf(); |
| 263 if (!in_cf) { | 263 if (!in_cf) { |
| 264 LOG(ERROR) << "Test not implemented for this configuration."; | 264 LOG(ERROR) << "Test not implemented for this configuration."; |
| 265 return; | 265 return; |
| 266 } | 266 } |
| 267 MockIEEventSink view_source_mock; | 267 MockIEEventSink view_source_mock; |
| 268 view_source_mock.ExpectAnyNavigations(); | 268 view_source_mock.ExpectAnyNavigations(); |
| 269 InSequence expect_in_sequence_for_scope; | 269 InSequence expect_in_sequence_for_scope; |
| 270 | 270 |
| 271 // After navigation invoke view soruce action using IWebBrowser2::ExecWB | 271 // After navigation invoke view soruce action using IWebBrowser2::ExecWB |
| 272 VARIANT empty = ScopedVariant::kEmptyVariant; | 272 VARIANT empty = base::win::ScopedVariant::kEmptyVariant; |
| 273 EXPECT_CALL(ie_mock_, OnLoad(in_cf, | 273 EXPECT_CALL(ie_mock_, OnLoad(in_cf, |
| 274 StrEq(GetSimplePageUrl()))) | 274 StrEq(GetSimplePageUrl()))) |
| 275 .WillOnce(DelayExecCommand(&ie_mock_, &loop_, 0, &CGID_MSHTML, | 275 .WillOnce(DelayExecCommand(&ie_mock_, &loop_, 0, &CGID_MSHTML, |
| 276 static_cast<OLECMDID>(IDM_VIEWSOURCE), | 276 static_cast<OLECMDID>(IDM_VIEWSOURCE), |
| 277 OLECMDEXECOPT_DONTPROMPTUSER, &empty, &empty)); | 277 OLECMDEXECOPT_DONTPROMPTUSER, &empty, &empty)); |
| 278 | 278 |
| 279 // Expect notification for view-source window, handle new window event | 279 // Expect notification for view-source window, handle new window event |
| 280 // and attach a new ie_mock_ to the received web browser | 280 // and attach a new ie_mock_ to the received web browser |
| 281 std::wstring view_source_url; | 281 std::wstring view_source_url; |
| 282 view_source_url += UTF8ToWide(chrome::kViewSourceScheme); | 282 view_source_url += UTF8ToWide(chrome::kViewSourceScheme); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 302 } | 302 } |
| 303 | 303 |
| 304 void NavigateToCurrentUrl(MockIEEventSink* mock) { | 304 void NavigateToCurrentUrl(MockIEEventSink* mock) { |
| 305 IWebBrowser2* browser = mock->event_sink()->web_browser2(); | 305 IWebBrowser2* browser = mock->event_sink()->web_browser2(); |
| 306 DCHECK(browser); | 306 DCHECK(browser); |
| 307 base::win::ScopedBstr bstr; | 307 base::win::ScopedBstr bstr; |
| 308 HRESULT hr = browser->get_LocationURL(bstr.Receive()); | 308 HRESULT hr = browser->get_LocationURL(bstr.Receive()); |
| 309 EXPECT_HRESULT_SUCCEEDED(hr); | 309 EXPECT_HRESULT_SUCCEEDED(hr); |
| 310 if (SUCCEEDED(hr)) { | 310 if (SUCCEEDED(hr)) { |
| 311 DCHECK(bstr.Length()); | 311 DCHECK(bstr.Length()); |
| 312 VARIANT empty = ScopedVariant::kEmptyVariant; | 312 VARIANT empty = base::win::ScopedVariant::kEmptyVariant; |
| 313 hr = browser->Navigate(bstr, &empty, &empty, &empty, &empty); | 313 hr = browser->Navigate(bstr, &empty, &empty, &empty, &empty); |
| 314 EXPECT_HRESULT_SUCCEEDED(hr); | 314 EXPECT_HRESULT_SUCCEEDED(hr); |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 | 317 |
| 318 // Tests that Chrome gets re-instantiated after crash if we reload via | 318 // Tests that Chrome gets re-instantiated after crash if we reload via |
| 319 // the address bar or via a new navigation. | 319 // the address bar or via a new navigation. |
| 320 TEST_P(FullTabUITest, TabCrashReload) { | 320 TEST_P(FullTabUITest, TabCrashReload) { |
| 321 using testing::DoAll; | 321 using testing::DoAll; |
| 322 | 322 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 MockPropertyNotifySinkListener prop_listener; | 358 MockPropertyNotifySinkListener prop_listener; |
| 359 InSequence expect_in_sequence_for_scope; | 359 InSequence expect_in_sequence_for_scope; |
| 360 | 360 |
| 361 EXPECT_CALL(ie_mock_, OnLoad(_, StrEq(GetSimplePageUrl()))) | 361 EXPECT_CALL(ie_mock_, OnLoad(_, StrEq(GetSimplePageUrl()))) |
| 362 .WillOnce(DoAll( | 362 .WillOnce(DoAll( |
| 363 ExpectRendererHasFocus(&ie_mock_), | 363 ExpectRendererHasFocus(&ie_mock_), |
| 364 ExpectDocumentReadystate(&ie_mock_, READYSTATE_COMPLETE), | 364 ExpectDocumentReadystate(&ie_mock_, READYSTATE_COMPLETE), |
| 365 ConnectDocPropNotifySink(&ie_mock_, &prop_listener), | 365 ConnectDocPropNotifySink(&ie_mock_, &prop_listener), |
| 366 KillChromeFrameProcesses())); | 366 KillChromeFrameProcesses())); |
| 367 | 367 |
| 368 VARIANT empty = ScopedVariant::kEmptyVariant; | 368 VARIANT empty = base::win::ScopedVariant::kEmptyVariant; |
| 369 EXPECT_CALL(prop_listener, OnChanged(/*DISPID_READYSTATE*/_)) | 369 EXPECT_CALL(prop_listener, OnChanged(/*DISPID_READYSTATE*/_)) |
| 370 .WillOnce(DoAll( | 370 .WillOnce(DoAll( |
| 371 DisconnectDocPropNotifySink(&prop_listener), | 371 DisconnectDocPropNotifySink(&prop_listener), |
| 372 ExpectDocumentReadystate(&ie_mock_, READYSTATE_UNINITIALIZED), | 372 ExpectDocumentReadystate(&ie_mock_, READYSTATE_UNINITIALIZED), |
| 373 DelayExecCommand(&ie_mock_, &loop_, 10, static_cast<GUID*>(NULL), | 373 DelayExecCommand(&ie_mock_, &loop_, 10, static_cast<GUID*>(NULL), |
| 374 OLECMDID_REFRESH, 0, &empty, &empty))); | 374 OLECMDID_REFRESH, 0, &empty, &empty))); |
| 375 | 375 |
| 376 EXPECT_CALL(ie_mock_, OnLoad(_, StrEq(GetSimplePageUrl()))) | 376 EXPECT_CALL(ie_mock_, OnLoad(_, StrEq(GetSimplePageUrl()))) |
| 377 .WillOnce(CloseBrowserMock(&ie_mock_)); | 377 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 378 | 378 |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 EXPECT_CALL(acc_observer_, OnMenuPopup(_)) | 956 EXPECT_CALL(acc_observer_, OnMenuPopup(_)) |
| 957 .WillOnce(AccLeftClick(AccObjectMatcher(L"Forward"))); | 957 .WillOnce(AccLeftClick(AccObjectMatcher(L"Forward"))); |
| 958 | 958 |
| 959 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(page3))) | 959 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(page3))) |
| 960 .WillOnce(CloseBrowserMock(&ie_mock_)); | 960 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 961 | 961 |
| 962 LaunchIEAndNavigate(page1); | 962 LaunchIEAndNavigate(page1); |
| 963 } | 963 } |
| 964 | 964 |
| 965 } // namespace chrome_frame_test | 965 } // namespace chrome_frame_test |
| OLD | NEW |