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

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

Issue 10736064: Switch to TimeDelta interfaces in chrome automation test infrastructure. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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
« no previous file with comments | « chrome/test/automation/automation_proxy.h ('k') | chrome/test/automation/browser_proxy.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/test/automation/automation_proxy.h" 5 #include "chrome/test/automation/automation_proxy.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 AutomationProxy* server_; 92 AutomationProxy* server_;
93 93
94 DISALLOW_COPY_AND_ASSIGN(AutomationMessageFilter); 94 DISALLOW_COPY_AND_ASSIGN(AutomationMessageFilter);
95 }; 95 };
96 96
97 } // anonymous namespace 97 } // anonymous namespace
98 98
99 99
100 AutomationProxy::AutomationProxy(int action_timeout_ms, 100 AutomationProxy::AutomationProxy(base::TimeDelta action_timeout,
101 bool disconnect_on_failure) 101 bool disconnect_on_failure)
102 : app_launched_(true, false), 102 : app_launched_(true, false),
103 initial_loads_complete_(true, false), 103 initial_loads_complete_(true, false),
104 new_tab_ui_load_complete_(true, false), 104 new_tab_ui_load_complete_(true, false),
105 shutdown_event_(new base::WaitableEvent(true, false)), 105 shutdown_event_(new base::WaitableEvent(true, false)),
106 perform_version_check_(false), 106 perform_version_check_(false),
107 disconnect_on_failure_(disconnect_on_failure), 107 disconnect_on_failure_(disconnect_on_failure),
108 channel_disconnected_on_failure_(false), 108 channel_disconnected_on_failure_(false),
109 action_timeout_( 109 action_timeout_(action_timeout),
110 TimeDelta::FromMilliseconds(action_timeout_ms)),
111 listener_thread_id_(0) { 110 listener_thread_id_(0) {
112 // base::WaitableEvent::TimedWait() will choke if we give it a negative value. 111 // base::WaitableEvent::TimedWait() will choke if we give it a negative value.
113 // Zero also seems unreasonable, since we need to wait for IPC, but at 112 // Zero also seems unreasonable, since we need to wait for IPC, but at
114 // least it is legal... ;-) 113 // least it is legal... ;-)
115 DCHECK_GE(action_timeout_ms, 0); 114 DCHECK_GE(action_timeout.InMilliseconds(), 0);
116 listener_thread_id_ = base::PlatformThread::CurrentId(); 115 listener_thread_id_ = base::PlatformThread::CurrentId();
117 InitializeHandleTracker(); 116 InitializeHandleTracker();
118 InitializeThread(); 117 InitializeThread();
119 } 118 }
120 119
121 AutomationProxy::~AutomationProxy() { 120 AutomationProxy::~AutomationProxy() {
122 // Destruction order is important. Thread has to outlive the channel and 121 // Destruction order is important. Thread has to outlive the channel and
123 // tracker has to outlive the thread since we access the tracker inside 122 // tracker has to outlive the thread since we access the tracker inside
124 // AutomationMessageFilter::OnMessageReceived. 123 // AutomationMessageFilter::OnMessageReceived.
125 Disconnect(); 124 Disconnect();
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 } 471 }
473 472
474 bool AutomationProxy::SendJSONRequest(const std::string& request, 473 bool AutomationProxy::SendJSONRequest(const std::string& request,
475 int timeout_ms, 474 int timeout_ms,
476 std::string* response) { 475 std::string* response) {
477 bool result = false; 476 bool result = false;
478 if (!SendAutomationJSONRequest(this, request, timeout_ms, response, &result)) 477 if (!SendAutomationJSONRequest(this, request, timeout_ms, response, &result))
479 return false; 478 return false;
480 return result; 479 return result;
481 } 480 }
OLDNEW
« no previous file with comments | « chrome/test/automation/automation_proxy.h ('k') | chrome/test/automation/browser_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698