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

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

Issue 6012006: Revert 68944 - Revert "Add named testing interface." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 12 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/ui/named_interface_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/test/automation/proxy_launcher.h"
6
7 #include "chrome/common/automation_constants.h"
8 #include "chrome/common/logging_chrome.h"
9 #include "chrome/test/automation/automation_proxy.h"
10 #include "chrome/test/ui/ui_test.h"
11
12 // Default path of named testing interface.
13 static const char kInterfacePath[] = "/var/tmp/ChromeTestingInterface";
14
15 // NamedProxyLauncher functions
16
17 NamedProxyLauncher::NamedProxyLauncher(bool launch_browser,
18 bool disconnect_on_failure)
19 : launch_browser_(launch_browser),
20 disconnect_on_failure_(disconnect_on_failure) {
21 channel_id_ = kInterfacePath;
22 }
23
24 AutomationProxy* NamedProxyLauncher::CreateAutomationProxy(
25 int execution_timeout) {
26 AutomationProxy* proxy = new AutomationProxy(execution_timeout,
27 disconnect_on_failure_);
28 proxy->InitializeChannel(channel_id_, true);
29 return proxy;
30 }
31
32 void NamedProxyLauncher::InitializeConnection(UITestBase* ui_test_base) const {
33 if (launch_browser_) {
34 // Set up IPC testing interface as a client.
35 ui_test_base->LaunchBrowser();
36
37 // Wait for browser to be ready for connections.
38 struct stat file_info;
39 while (stat(kInterfacePath, &file_info))
40 PlatformThread::Sleep(automation::kSleepTime);
41 }
42
43 ui_test_base->ConnectToRunningBrowser();
44 }
45
46 std::string NamedProxyLauncher::PrefixedChannelID() const {
47 std::string channel_id;
48 channel_id.append(automation::kNamedInterfacePrefix).append(channel_id_);
49 return channel_id;
50 }
51
52 // AnonymousProxyLauncher functions
53
54 AnonymousProxyLauncher::AnonymousProxyLauncher(bool disconnect_on_failure)
55 : disconnect_on_failure_(disconnect_on_failure) {
56 channel_id_ = AutomationProxy::GenerateChannelID();
57 }
58
59 AutomationProxy* AnonymousProxyLauncher::CreateAutomationProxy(
60 int execution_timeout) {
61 AutomationProxy* proxy = new AutomationProxy(execution_timeout,
62 disconnect_on_failure_);
63 proxy->InitializeChannel(channel_id_, false);
64 return proxy;
65 }
66
67 void AnonymousProxyLauncher::InitializeConnection(
68 UITestBase* ui_test_base) const {
69 ui_test_base->LaunchBrowserAndServer();
70 }
71
72 std::string AnonymousProxyLauncher::PrefixedChannelID() const {
73 return channel_id_;
74 }
75
OLDNEW
« no previous file with comments | « chrome/test/automation/proxy_launcher.h ('k') | chrome/test/ui/named_interface_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698