| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/win/scoped_variant.h" | 10 #include "base/win/scoped_variant.h" |
| 10 #include "base/utf_string_conversions.h" | |
| 11 #include "chrome_frame/test/mock_ie_event_sink_actions.h" | 11 #include "chrome_frame/test/mock_ie_event_sink_actions.h" |
| 12 | 12 |
| 13 // Needed for CreateFunctor. | 13 // Needed for CreateFunctor. |
| 14 #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING | 14 #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 15 #include "testing/gmock_mutant.h" | 15 #include "testing/gmock_mutant.h" |
| 16 | 16 |
| 17 using testing::_; | 17 using testing::_; |
| 18 using testing::Cardinality; | 18 using testing::Cardinality; |
| 19 using testing::Exactly; | 19 using testing::Exactly; |
| 20 using testing::ExpectationSet; | 20 using testing::ExpectationSet; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 void MockIEEventSink::ExpectAnyNavigations() { | 150 void MockIEEventSink::ExpectAnyNavigations() { |
| 151 EXPECT_CALL(*this, OnBeforeNavigate2(_, _, _, _, _, _, _)) | 151 EXPECT_CALL(*this, OnBeforeNavigate2(_, _, _, _, _, _, _)) |
| 152 .Times(testing::AnyNumber()); | 152 .Times(testing::AnyNumber()); |
| 153 EXPECT_CALL(*this, OnFileDownload(VARIANT_TRUE, _)) | 153 EXPECT_CALL(*this, OnFileDownload(VARIANT_TRUE, _)) |
| 154 .Times(testing::AnyNumber()); | 154 .Times(testing::AnyNumber()); |
| 155 EXPECT_CALL(*this, OnNavigateComplete2(_, _)) | 155 EXPECT_CALL(*this, OnNavigateComplete2(_, _)) |
| 156 .Times(testing::AnyNumber()); | 156 .Times(testing::AnyNumber()); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void MockIEEventSink::ExpectDocumentReadystate(int ready_state) { | 159 void MockIEEventSink::ExpectDocumentReadystate(int ready_state) { |
| 160 ScopedComPtr<IWebBrowser2> browser(event_sink_->web_browser2()); | 160 base::win::ScopedComPtr<IWebBrowser2> browser(event_sink_->web_browser2()); |
| 161 EXPECT_TRUE(browser != NULL); | 161 EXPECT_TRUE(browser != NULL); |
| 162 if (browser) { | 162 if (browser) { |
| 163 ScopedComPtr<IDispatch> document; | 163 base::win::ScopedComPtr<IDispatch> document; |
| 164 browser->get_Document(document.Receive()); | 164 browser->get_Document(document.Receive()); |
| 165 EXPECT_TRUE(document != NULL); | 165 EXPECT_TRUE(document != NULL); |
| 166 if (document) { | 166 if (document) { |
| 167 DISPPARAMS params = { 0 }; | 167 DISPPARAMS params = { 0 }; |
| 168 base::win::ScopedVariant result; | 168 base::win::ScopedVariant result; |
| 169 EXPECT_HRESULT_SUCCEEDED(document->Invoke(DISPID_READYSTATE, IID_NULL, | 169 EXPECT_HRESULT_SUCCEEDED(document->Invoke(DISPID_READYSTATE, IID_NULL, |
| 170 LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, ¶ms, | 170 LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, ¶ms, |
| 171 result.Receive(), NULL, NULL)); | 171 result.Receive(), NULL, NULL)); |
| 172 EXPECT_EQ(VT_I4, result.type()); | 172 EXPECT_EQ(VT_I4, result.type()); |
| 173 if (result.type() == VT_I4) { | 173 if (result.type() == VT_I4) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 const std::wstring& relative_path) { | 220 const std::wstring& relative_path) { |
| 221 return server_mock_.root_dir().Append(relative_path); | 221 return server_mock_.root_dir().Append(relative_path); |
| 222 } | 222 } |
| 223 | 223 |
| 224 std::wstring MockIEEventSinkTest::GetTestUrl( | 224 std::wstring MockIEEventSinkTest::GetTestUrl( |
| 225 const std::wstring& relative_path) { | 225 const std::wstring& relative_path) { |
| 226 return server_mock_.Resolve(relative_path.c_str()); | 226 return server_mock_.Resolve(relative_path.c_str()); |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace chrome_frame_test | 229 } // namespace chrome_frame_test |
| OLD | NEW |