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

Side by Side Diff: chrome/test/automation/proxy_launcher.cc

Issue 7629019: Revert 96556 - Let pyauto create an attached webdriver instance to manipulate web pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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/test/automation/proxy_launcher.h ('k') | chrome/test/functional/PYAUTO_TESTS » ('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) 2011 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/test/automation/proxy_launcher.h" 5 #include "chrome/test/automation/proxy_launcher.h"
6 6
7 #include "base/environment.h" 7 #include "base/environment.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 512 }
513 513
514 AutomationProxy* NamedProxyLauncher::CreateAutomationProxy( 514 AutomationProxy* NamedProxyLauncher::CreateAutomationProxy(
515 int execution_timeout) { 515 int execution_timeout) {
516 AutomationProxy* proxy = new AutomationProxy(execution_timeout, 516 AutomationProxy* proxy = new AutomationProxy(execution_timeout,
517 disconnect_on_failure_); 517 disconnect_on_failure_);
518 proxy->InitializeChannel(channel_id_, true); 518 proxy->InitializeChannel(channel_id_, true);
519 return proxy; 519 return proxy;
520 } 520 }
521 521
522 bool NamedProxyLauncher::InitializeConnection(const LaunchState& state, 522 void NamedProxyLauncher::InitializeConnection(const LaunchState& state,
523 bool wait_for_initial_loads) { 523 bool wait_for_initial_loads) {
524 if (launch_browser_) { 524 if (launch_browser_) {
525 #if defined(OS_POSIX) 525 #if defined(OS_POSIX)
526 // Because we are waiting on the existence of the testing file below, 526 // Because we are waiting on the existence of the testing file below,
527 // make sure there isn't one already there before browser launch. 527 // make sure there isn't one already there before browser launch.
528 if (!file_util::Delete(FilePath(channel_id_), false)) { 528 EXPECT_TRUE(file_util::Delete(FilePath(channel_id_), false));
529 LOG(ERROR) << "Failed to delete " << channel_id_;
530 return false;
531 }
532 #endif 529 #endif
533 530
534 if (!LaunchBrowser(state)) { 531 // Set up IPC testing interface as a client.
535 LOG(ERROR) << "Failed to LaunchBrowser"; 532 ASSERT_TRUE(LaunchBrowser(state));
536 return false;
537 }
538 } 533 }
539 534
540 // Wait for browser to be ready for connections. 535 // Wait for browser to be ready for connections.
541 bool channel_initialized = false; 536 bool channel_initialized = false;
542 for (int wait_time = 0; 537 for (int wait_time = 0;
543 wait_time < TestTimeouts::action_max_timeout_ms(); 538 wait_time < TestTimeouts::action_max_timeout_ms();
544 wait_time += automation::kSleepTime) { 539 wait_time += automation::kSleepTime) {
545 channel_initialized = IPC::Channel::IsNamedServerInitialized(channel_id_); 540 channel_initialized = IPC::Channel::IsNamedServerInitialized(channel_id_);
546 if (channel_initialized) 541 if (channel_initialized)
547 break; 542 break;
548 base::PlatformThread::Sleep(automation::kSleepTime); 543 base::PlatformThread::Sleep(automation::kSleepTime);
549 } 544 }
550 if (!channel_initialized) { 545 EXPECT_TRUE(channel_initialized);
551 LOG(ERROR) << "Failed to wait for testing channel presence.";
552 return false;
553 }
554 546
555 if (!ConnectToRunningBrowser(wait_for_initial_loads)) { 547 ASSERT_TRUE(ConnectToRunningBrowser(wait_for_initial_loads));
556 LOG(ERROR) << "Failed to ConnectToRunningBrowser";
557 return false;
558 }
559 return true;
560 } 548 }
561 549
562 void NamedProxyLauncher::TerminateConnection() { 550 void NamedProxyLauncher::TerminateConnection() {
563 if (launch_browser_) 551 if (launch_browser_)
564 CloseBrowserAndServer(); 552 CloseBrowserAndServer();
565 else 553 else
566 DisconnectFromRunningBrowser(); 554 DisconnectFromRunningBrowser();
567 } 555 }
568 556
569 std::string NamedProxyLauncher::PrefixedChannelID() const { 557 std::string NamedProxyLauncher::PrefixedChannelID() const {
(...skipping 10 matching lines...) Expand all
580 } 568 }
581 569
582 AutomationProxy* AnonymousProxyLauncher::CreateAutomationProxy( 570 AutomationProxy* AnonymousProxyLauncher::CreateAutomationProxy(
583 int execution_timeout) { 571 int execution_timeout) {
584 AutomationProxy* proxy = new AutomationProxy(execution_timeout, 572 AutomationProxy* proxy = new AutomationProxy(execution_timeout,
585 disconnect_on_failure_); 573 disconnect_on_failure_);
586 proxy->InitializeChannel(channel_id_, false); 574 proxy->InitializeChannel(channel_id_, false);
587 return proxy; 575 return proxy;
588 } 576 }
589 577
590 bool AnonymousProxyLauncher::InitializeConnection(const LaunchState& state, 578 void AnonymousProxyLauncher::InitializeConnection(const LaunchState& state,
591 bool wait_for_initial_loads) { 579 bool wait_for_initial_loads) {
592 return LaunchBrowserAndServer(state, wait_for_initial_loads); 580 ASSERT_TRUE(LaunchBrowserAndServer(state, wait_for_initial_loads));
593 } 581 }
594 582
595 void AnonymousProxyLauncher::TerminateConnection() { 583 void AnonymousProxyLauncher::TerminateConnection() {
596 CloseBrowserAndServer(); 584 CloseBrowserAndServer();
597 } 585 }
598 586
599 std::string AnonymousProxyLauncher::PrefixedChannelID() const { 587 std::string AnonymousProxyLauncher::PrefixedChannelID() const {
600 return channel_id_; 588 return channel_id_;
601 } 589 }
OLDNEW
« no previous file with comments | « chrome/test/automation/proxy_launcher.h ('k') | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698