| 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 #include "chrome_frame/test/automation_client_mock.h" | 4 #include "chrome_frame/test/automation_client_mock.h" |
| 5 | 5 |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "chrome_frame/custom_sync_call_context.h" | 7 #include "chrome_frame/custom_sync_call_context.h" |
| 8 #include "chrome_frame/navigation_constraints.h" | 8 #include "chrome_frame/navigation_constraints.h" |
| 9 #include "chrome_frame/test/chrome_frame_test_utils.h" | 9 #include "chrome_frame/test/chrome_frame_test_utils.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 scoped_refptr<ChromeFrameAutomationClient> client; | 163 scoped_refptr<ChromeFrameAutomationClient> client; |
| 164 client = new ChromeFrameAutomationClient; | 164 client = new ChromeFrameAutomationClient; |
| 165 | 165 |
| 166 EXPECT_CALL(cfd, OnAutomationServerReady()) | 166 EXPECT_CALL(cfd, OnAutomationServerReady()) |
| 167 .WillOnce(InitiateNavigation(client.get(), | 167 .WillOnce(InitiateNavigation(client.get(), |
| 168 url, std::string(), | 168 url, std::string(), |
| 169 &navigation_constraints)); | 169 &navigation_constraints)); |
| 170 | 170 |
| 171 EXPECT_CALL(cfd, GetBounds(_)).Times(testing::AnyNumber()); | 171 EXPECT_CALL(cfd, GetBounds(_)).Times(testing::AnyNumber()); |
| 172 | 172 |
| 173 EXPECT_CALL(cfd, OnNavigationStateChanged(_, _)) | 173 EXPECT_CALL(cfd, OnNavigationStateChanged(_)) |
| 174 .Times(testing::AnyNumber()); | 174 .Times(testing::AnyNumber()); |
| 175 | 175 |
| 176 { | 176 { |
| 177 testing::InSequence s; | 177 testing::InSequence s; |
| 178 | 178 |
| 179 EXPECT_CALL(cfd, OnDidNavigate(_, EqNavigationInfoUrl(GURL()))) | 179 EXPECT_CALL(cfd, OnDidNavigate(EqNavigationInfoUrl(GURL()))) |
| 180 .Times(1); | 180 .Times(1); |
| 181 | 181 |
| 182 EXPECT_CALL(cfd, OnUpdateTargetUrl(_, _)).Times(testing::AtMost(1)); | 182 EXPECT_CALL(cfd, OnUpdateTargetUrl(_)).Times(testing::AtMost(1)); |
| 183 | 183 |
| 184 EXPECT_CALL(cfd, OnLoad(_, _)) | 184 EXPECT_CALL(cfd, OnLoad(_)) |
| 185 .Times(1) | 185 .Times(1) |
| 186 .WillOnce(QUIT_LOOP(loop)); | 186 .WillOnce(QUIT_LOOP(loop)); |
| 187 } | 187 } |
| 188 | 188 |
| 189 GURL empty; | 189 GURL empty; |
| 190 scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams( | 190 scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams( |
| 191 empty, empty, profile_path, profile_path.BaseName().value(), L"", L"", | 191 empty, empty, profile_path, profile_path.BaseName().value(), L"", L"", |
| 192 false, false, false)); | 192 false, false, false)); |
| 193 clp->set_launch_timeout(timeout); | 193 clp->set_launch_timeout(timeout); |
| 194 clp->set_version_check(false); | 194 clp->set_version_check(false); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 211 scoped_refptr<ChromeFrameAutomationClient> client; | 211 scoped_refptr<ChromeFrameAutomationClient> client; |
| 212 client = new ChromeFrameAutomationClient; | 212 client = new ChromeFrameAutomationClient; |
| 213 cfd.SetRequestDelegate(client); | 213 cfd.SetRequestDelegate(client); |
| 214 | 214 |
| 215 EXPECT_CALL(cfd, OnAutomationServerReady()) | 215 EXPECT_CALL(cfd, OnAutomationServerReady()) |
| 216 .WillOnce(testing::IgnoreResult(testing::InvokeWithoutArgs(CreateFunctor( | 216 .WillOnce(testing::IgnoreResult(testing::InvokeWithoutArgs(CreateFunctor( |
| 217 client.get(), &ChromeFrameAutomationClient::InitiateNavigation, | 217 client.get(), &ChromeFrameAutomationClient::InitiateNavigation, |
| 218 url, std::string(), &navigation_constraints)))); | 218 url, std::string(), &navigation_constraints)))); |
| 219 | 219 |
| 220 EXPECT_CALL(cfd, GetBounds(_)).Times(testing::AnyNumber()); | 220 EXPECT_CALL(cfd, GetBounds(_)).Times(testing::AnyNumber()); |
| 221 EXPECT_CALL(cfd, OnNavigationStateChanged(_, _)).Times(testing::AnyNumber()); | 221 EXPECT_CALL(cfd, OnNavigationStateChanged(_)).Times(testing::AnyNumber()); |
| 222 | 222 |
| 223 EXPECT_CALL(cfd, OnRequestStart(_, _, _)) | 223 EXPECT_CALL(cfd, OnRequestStart(_, _)) |
| 224 // Often there's another request for the error page | 224 // Often there's another request for the error page |
| 225 .Times(testing::Between(1, 2)) | 225 .Times(testing::Between(1, 2)) |
| 226 .WillRepeatedly(testing::WithArgs<1>(testing::Invoke(CreateFunctor(&cfd, | 226 .WillRepeatedly(testing::WithArgs<0>(testing::Invoke(CreateFunctor(&cfd, |
| 227 &MockCFDelegate::Reply, connection_failed)))); | 227 &MockCFDelegate::Reply, connection_failed)))); |
| 228 | 228 |
| 229 EXPECT_CALL(cfd, OnUpdateTargetUrl(_, _)).Times(testing::AnyNumber()); | 229 EXPECT_CALL(cfd, OnUpdateTargetUrl(_)).Times(testing::AnyNumber()); |
| 230 EXPECT_CALL(cfd, OnLoad(_, _)).Times(testing::AtMost(1)); | 230 EXPECT_CALL(cfd, OnLoad(_)).Times(testing::AtMost(1)); |
| 231 | 231 |
| 232 EXPECT_CALL(cfd, OnNavigationFailed(_, _, GURL(url))) | 232 EXPECT_CALL(cfd, OnNavigationFailed(_, GURL(url))) |
| 233 .Times(1) | 233 .Times(1) |
| 234 .WillOnce(QUIT_LOOP_SOON(loop, 2)); | 234 .WillOnce(QUIT_LOOP_SOON(loop, 2)); |
| 235 | 235 |
| 236 GURL empty; | 236 GURL empty; |
| 237 scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams( | 237 scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams( |
| 238 empty, empty, profile_path, profile_path.BaseName().value(), L"", L"", | 238 empty, empty, profile_path, profile_path.BaseName().value(), L"", L"", |
| 239 false, false, false)); | 239 false, false, false)); |
| 240 clp->set_launch_timeout(10000); | 240 clp->set_launch_timeout(10000); |
| 241 clp->set_version_check(false); | 241 clp->set_version_check(false); |
| 242 EXPECT_TRUE(client->Initialize(&cfd, clp)); | 242 EXPECT_TRUE(client->Initialize(&cfd, clp)); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 profile_path_.BaseName().value(), L"", L"", false, false, false)); | 470 profile_path_.BaseName().value(), L"", L"", false, false, false)); |
| 471 launch_params->set_launch_timeout(timeout); | 471 launch_params->set_launch_timeout(timeout); |
| 472 launch_params->set_version_check(false); | 472 launch_params->set_version_check(false); |
| 473 EXPECT_TRUE(client_->Initialize(&cfd_, launch_params)); | 473 EXPECT_TRUE(client_->Initialize(&cfd_, launch_params)); |
| 474 loop_.RunFor(10); | 474 loop_.RunFor(10); |
| 475 | 475 |
| 476 EXPECT_CALL(mock_proxy_, ReleaseTabProxy(testing::Eq(tab_handle_))).Times(1); | 476 EXPECT_CALL(mock_proxy_, ReleaseTabProxy(testing::Eq(tab_handle_))).Times(1); |
| 477 client_->Uninitialize(); | 477 client_->Uninitialize(); |
| 478 } | 478 } |
| 479 | 479 |
| OLD | NEW |