Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: chrome_frame/test/automation_client_mock.cc

Issue 14030003: Remove Chrome Frame's delay shutdown field trial. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Dear Greg Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/metrics_service.h ('k') | chrome_frame/test/chrome_frame_automation_mock.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/automation_client_mock.h" 5 #include "chrome_frame/test/automation_client_mock.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "chrome/common/automation_messages.h" 9 #include "chrome/common/automation_messages.h"
10 #include "chrome_frame/custom_sync_call_context.h" 10 #include "chrome_frame/custom_sync_call_context.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 void CFACWithChrome::TearDownTestCase() { 130 void CFACWithChrome::TearDownTestCase() {
131 profile_path_.clear(); 131 profile_path_.clear();
132 } 132 }
133 133
134 void CFACWithChrome::SetUp() { 134 void CFACWithChrome::SetUp() {
135 chrome_frame_test::OverrideDataDirectoryForThisTest(profile_path_.value()); 135 chrome_frame_test::OverrideDataDirectoryForThisTest(profile_path_.value());
136 client_ = new ChromeFrameAutomationClient(); 136 client_ = new ChromeFrameAutomationClient();
137 GURL empty; 137 GURL empty;
138 launch_params_ = new ChromeFrameLaunchParams( 138 launch_params_ = new ChromeFrameLaunchParams(
139 empty, empty, profile_path_, profile_path_.BaseName().value(), L"", 139 empty, empty, profile_path_, profile_path_.BaseName().value(), L"",
140 false, false, false, false); 140 false, false, false);
141 launch_params_->set_version_check(false); 141 launch_params_->set_version_check(false);
142 launch_params_->set_launch_timeout(kSaneAutomationTimeoutMs); 142 launch_params_->set_launch_timeout(kSaneAutomationTimeoutMs);
143 } 143 }
144 144
145 void CFACWithChrome::TearDown() { 145 void CFACWithChrome::TearDown() {
146 client_->Uninitialize(); 146 client_->Uninitialize();
147 } 147 }
148 148
149 // We mock ChromeFrameDelegate only. The rest is with real AutomationProxy 149 // We mock ChromeFrameDelegate only. The rest is with real AutomationProxy
150 TEST_F(CFACWithChrome, CreateTooFast) { 150 TEST_F(CFACWithChrome, CreateTooFast) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 EXPECT_CALL(cfd_, OnAutomationServerReady()) 260 EXPECT_CALL(cfd_, OnAutomationServerReady())
261 .WillOnce(QUIT_LOOP(loop_)); 261 .WillOnce(QUIT_LOOP(loop_));
262 262
263 EXPECT_CALL(mock_proxy_, CancelAsync(_)).Times(testing::AnyNumber()); 263 EXPECT_CALL(mock_proxy_, CancelAsync(_)).Times(testing::AnyNumber());
264 264
265 // Here we go! 265 // Here we go!
266 GURL empty; 266 GURL empty;
267 scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams( 267 scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams(
268 empty, empty, profile_path_, profile_path_.BaseName().value(), L"", 268 empty, empty, profile_path_, profile_path_.BaseName().value(), L"",
269 false, false, false, false)); 269 false, false, false));
270 clp->set_launch_timeout(timeout); 270 clp->set_launch_timeout(timeout);
271 clp->set_version_check(false); 271 clp->set_version_check(false);
272 EXPECT_TRUE(client_->Initialize(&cfd_, clp)); 272 EXPECT_TRUE(client_->Initialize(&cfd_, clp));
273 loop_.RunFor(base::TimeDelta::FromSeconds(10)); 273 loop_.RunFor(base::TimeDelta::FromSeconds(10));
274 274
275 EXPECT_CALL(mock_proxy_, ReleaseTabProxy(testing::Eq(tab_handle_))).Times(1); 275 EXPECT_CALL(mock_proxy_, ReleaseTabProxy(testing::Eq(tab_handle_))).Times(1);
276 client_->Uninitialize(); 276 client_->Uninitialize();
277 } 277 }
278 278
279 TEST_F(CFACMockTest, MockedCreateTabFailed) { 279 TEST_F(CFACMockTest, MockedCreateTabFailed) {
(...skipping 12 matching lines...) Expand all
292 EXPECT_CALL(mock_proxy_, CreateTabProxy(_)).Times(0); 292 EXPECT_CALL(mock_proxy_, CreateTabProxy(_)).Times(0);
293 293
294 EXPECT_CALL(mock_proxy_, CancelAsync(_)).Times(testing::AnyNumber()); 294 EXPECT_CALL(mock_proxy_, CancelAsync(_)).Times(testing::AnyNumber());
295 295
296 Set_CFD_LaunchFailed(AUTOMATION_CREATE_TAB_FAILED); 296 Set_CFD_LaunchFailed(AUTOMATION_CREATE_TAB_FAILED);
297 297
298 // Here we go! 298 // Here we go!
299 GURL empty; 299 GURL empty;
300 scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams( 300 scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams(
301 empty, empty, profile_path_, profile_path_.BaseName().value(), L"", 301 empty, empty, profile_path_, profile_path_.BaseName().value(), L"",
302 false, false, false, false)); 302 false, false, false));
303 clp->set_launch_timeout(timeout_); 303 clp->set_launch_timeout(timeout_);
304 clp->set_version_check(false); 304 clp->set_version_check(false);
305 EXPECT_TRUE(client_->Initialize(&cfd_, clp)); 305 EXPECT_TRUE(client_->Initialize(&cfd_, clp));
306 loop_.RunFor(base::TimeDelta::FromSeconds(4)); 306 loop_.RunFor(base::TimeDelta::FromSeconds(4));
307 client_->Uninitialize(); 307 client_->Uninitialize();
308 } 308 }
309 309
310 class TestChromeFrameAutomationProxyImpl 310 class TestChromeFrameAutomationProxyImpl
311 : public ChromeFrameAutomationProxyImpl { 311 : public ChromeFrameAutomationProxyImpl {
312 public: 312 public:
(...skipping 23 matching lines...) Expand all
336 } 336 }
337 337
338 TEST_F(CFACMockTest, OnChannelError) { 338 TEST_F(CFACMockTest, OnChannelError) {
339 const base::TimeDelta loop_duration = base::TimeDelta::FromSeconds(11); 339 const base::TimeDelta loop_duration = base::TimeDelta::FromSeconds(11);
340 TestChromeFrameAutomationProxyImpl proxy; 340 TestChromeFrameAutomationProxyImpl proxy;
341 returned_proxy_ = &proxy; 341 returned_proxy_ = &proxy;
342 342
343 GURL empty; 343 GURL empty;
344 scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams( 344 scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams(
345 empty, empty, profile_path_, profile_path_.BaseName().value(), L"", 345 empty, empty, profile_path_, profile_path_.BaseName().value(), L"",
346 false, false, false, false)); 346 false, false, false));
347 clp->set_launch_timeout(1); // Unneeded timeout, but can't be 0. 347 clp->set_launch_timeout(1); // Unneeded timeout, but can't be 0.
348 clp->set_version_check(false); 348 clp->set_version_check(false);
349 349
350 HWND h1 = ::GetDesktopWindow(); 350 HWND h1 = ::GetDesktopWindow();
351 HWND h2 = ::GetDesktopWindow(); 351 HWND h2 = ::GetDesktopWindow();
352 EXPECT_CALL(proxy, SendAsAsync(testing::Property( 352 EXPECT_CALL(proxy, SendAsAsync(testing::Property(
353 &IPC::SyncMessage::type, AutomationMsg_CreateExternalTab::ID), 353 &IPC::SyncMessage::type, AutomationMsg_CreateExternalTab::ID),
354 testing::NotNull(), _)).Times(3) 354 testing::NotNull(), _)).Times(3)
355 .WillOnce(HandleCreateTab(tab_handle_, h1, h2, 99)) 355 .WillOnce(HandleCreateTab(tab_handle_, h1, h2, 99))
356 .WillOnce(HandleCreateTab(tab_handle_ * 2, h1, h2, 100)) 356 .WillOnce(HandleCreateTab(tab_handle_ * 2, h1, h2, 100))
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 .Times(1) 456 .Times(1)
457 .WillOnce(Return(true)); 457 .WillOnce(Return(true));
458 458
459 EXPECT_CALL(cfd_, GetBounds(_)).Times(1); 459 EXPECT_CALL(cfd_, GetBounds(_)).Times(1);
460 460
461 // Here we go! 461 // Here we go!
462 GURL empty; 462 GURL empty;
463 scoped_refptr<ChromeFrameLaunchParams> launch_params( 463 scoped_refptr<ChromeFrameLaunchParams> launch_params(
464 new ChromeFrameLaunchParams( 464 new ChromeFrameLaunchParams(
465 GURL("http://www.nonexistent.com"), empty, profile_path_, 465 GURL("http://www.nonexistent.com"), empty, profile_path_,
466 profile_path_.BaseName().value(), L"", false, false, false, false)); 466 profile_path_.BaseName().value(), L"", false, false, false));
467 launch_params->set_launch_timeout(timeout); 467 launch_params->set_launch_timeout(timeout);
468 launch_params->set_version_check(false); 468 launch_params->set_version_check(false);
469 EXPECT_TRUE(client_->Initialize(&cfd_, launch_params)); 469 EXPECT_TRUE(client_->Initialize(&cfd_, launch_params));
470 loop_.RunFor(base::TimeDelta::FromSeconds(10)); 470 loop_.RunFor(base::TimeDelta::FromSeconds(10));
471 471
472 EXPECT_CALL(mock_proxy_, ReleaseTabProxy(testing::Eq(tab_handle_))).Times(1); 472 EXPECT_CALL(mock_proxy_, ReleaseTabProxy(testing::Eq(tab_handle_))).Times(1);
473 client_->Uninitialize(); 473 client_->Uninitialize();
474 } 474 }
OLDNEW
« no previous file with comments | « chrome_frame/metrics_service.h ('k') | chrome_frame/test/chrome_frame_automation_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698