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

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

Issue 6685099: Removing command_execution_timeout_ms in favor of action_max_timeout_ms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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
OLDNEW
1 // Copyright (c) 2010 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/automation_proxy.h" 5 #include "chrome/test/automation/automation_proxy.h"
6 6
7 #include <gtest/gtest.h> 7 #include <gtest/gtest.h>
8 8
9 #include <sstream> 9 #include <sstream>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/threading/platform_thread.h" 13 #include "base/threading/platform_thread.h"
14 #include "base/process_util.h" 14 #include "base/process_util.h"
15 #include "base/ref_counted.h" 15 #include "base/ref_counted.h"
16 #include "base/synchronization/waitable_event.h" 16 #include "base/synchronization/waitable_event.h"
17 #include "base/test/test_timeouts.h"
17 #include "chrome/common/automation_constants.h" 18 #include "chrome/common/automation_constants.h"
18 #include "chrome/common/automation_messages.h" 19 #include "chrome/common/automation_messages.h"
19 #include "chrome/common/chrome_version_info.h" 20 #include "chrome/common/chrome_version_info.h"
20 #include "chrome/test/automation/automation_json_requests.h" 21 #include "chrome/test/automation/automation_json_requests.h"
21 #include "chrome/test/automation/browser_proxy.h" 22 #include "chrome/test/automation/browser_proxy.h"
22 #include "chrome/test/automation/extension_proxy.h" 23 #include "chrome/test/automation/extension_proxy.h"
23 #include "chrome/test/automation/tab_proxy.h" 24 #include "chrome/test/automation/tab_proxy.h"
24 #include "chrome/test/automation/window_proxy.h" 25 #include "chrome/test/automation/window_proxy.h"
25 #include "ipc/ipc_descriptors.h" 26 #include "ipc/ipc_descriptors.h"
26 #if defined(OS_WIN) 27 #if defined(OS_WIN)
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 base::file_handle_mapping_vector AutomationProxy::fds_to_map() const { 442 base::file_handle_mapping_vector AutomationProxy::fds_to_map() const {
442 base::file_handle_mapping_vector map; 443 base::file_handle_mapping_vector map;
443 const int ipcfd = channel_->GetClientFileDescriptor(); 444 const int ipcfd = channel_->GetClientFileDescriptor();
444 if (ipcfd > -1) 445 if (ipcfd > -1)
445 map.push_back(std::make_pair(ipcfd, kPrimaryIPCChannel + 3)); 446 map.push_back(std::make_pair(ipcfd, kPrimaryIPCChannel + 3));
446 return map; 447 return map;
447 } 448 }
448 #endif // defined(OS_POSIX) 449 #endif // defined(OS_POSIX)
449 450
450 bool AutomationProxy::Send(IPC::Message* message) { 451 bool AutomationProxy::Send(IPC::Message* message) {
452 return Send(message,
453 command_execution_timeout_.InMilliseconds());
Nirnimesh 2011/03/29 20:27:28 still command_execution_timeout_? or action_max_ti
Huyen 2011/03/31 02:42:55 Done. Changed it to action_timeout_ to make it con
454 }
455
456 bool AutomationProxy::Send(IPC::Message* message, int timeout_ms) {
451 if (!channel_.get()) { 457 if (!channel_.get()) {
452 LOG(ERROR) << "Automation channel has been closed; dropping message!"; 458 LOG(ERROR) << "Automation channel has been closed; dropping message!";
453 delete message; 459 delete message;
454 return false; 460 return false;
455 } 461 }
456 462
457 bool success = channel_->SendWithTimeout(message, 463 bool success = channel_->SendWithTimeout(message, timeout_ms);
458 command_execution_timeout_ms());
459 464
460 if (!success && disconnect_on_failure_) { 465 if (!success && disconnect_on_failure_) {
461 // Send failed (possibly due to a timeout). Browser is likely in a weird 466 // Send failed (possibly due to a timeout). Browser is likely in a weird
462 // state, and further IPC requests are extremely likely to fail (possibly 467 // state, and further IPC requests are extremely likely to fail (possibly
463 // timeout, which would make tests slower). Disconnect the channel now 468 // timeout, which would make tests slower). Disconnect the channel now
464 // to avoid the slowness. 469 // to avoid the slowness.
465 LOG(ERROR) << "Disconnecting channel after error!"; 470 LOG(ERROR) << "Disconnecting channel after error!";
466 Disconnect(); 471 Disconnect();
467 } 472 }
468 473
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 // If message sending unsuccessful or test failed, return false. 552 // If message sending unsuccessful or test failed, return false.
548 return sent && success; 553 return sent && success;
549 } 554 }
550 #endif 555 #endif
551 556
552 bool AutomationProxy::ResetToDefaultTheme() { 557 bool AutomationProxy::ResetToDefaultTheme() {
553 return Send(new AutomationMsg_ResetToDefaultTheme()); 558 return Send(new AutomationMsg_ResetToDefaultTheme());
554 } 559 }
555 560
556 bool AutomationProxy::SendJSONRequest(const std::string& request, 561 bool AutomationProxy::SendJSONRequest(const std::string& request,
557 std::string* response) { 562 std::string* response, int timeout) {
558 bool result = false; 563 bool result = false;
559 if (!SendAutomationJSONRequest(this, request, response, &result)) 564 if (!SendAutomationJSONRequest(this, request, response, &result, timeout))
Nirnimesh 2011/03/29 20:27:28 all out params (response, result) should go *after
Huyen 2011/03/31 02:42:55 Done.
560 return false; 565 return false;
561 return result; 566 return result;
562 } 567 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698