OLD | NEW |
1 // Copyright (c) 2011 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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 server_->SignalNewTabUITab(-1); | 72 server_->SignalNewTabUITab(-1); |
73 } | 73 } |
74 | 74 |
75 private: | 75 private: |
76 void NewTabLoaded(int load_time) { | 76 void NewTabLoaded(int load_time) { |
77 server_->SignalNewTabUITab(load_time); | 77 server_->SignalNewTabUITab(load_time); |
78 } | 78 } |
79 | 79 |
80 void OnAutomationHello(const IPC::Message& hello_message) { | 80 void OnAutomationHello(const IPC::Message& hello_message) { |
81 std::string server_version; | 81 std::string server_version; |
82 void* iter = NULL; | 82 PickleIterator iter(hello_message); |
83 if (!hello_message.ReadString(&iter, &server_version)) { | 83 if (!hello_message.ReadString(&iter, &server_version)) { |
84 // We got an AutomationMsg_Hello from an old automation provider | 84 // We got an AutomationMsg_Hello from an old automation provider |
85 // that doesn't send version info. Leave server_version as an empty | 85 // that doesn't send version info. Leave server_version as an empty |
86 // string to signal a version mismatch. | 86 // string to signal a version mismatch. |
87 LOG(ERROR) << "Pre-versioning protocol detected in automation provider."; | 87 LOG(ERROR) << "Pre-versioning protocol detected in automation provider."; |
88 } | 88 } |
89 | 89 |
90 server_->SignalAppLaunch(server_version); | 90 server_->SignalAppLaunch(server_version); |
91 } | 91 } |
92 | 92 |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // to avoid the slowness. | 455 // to avoid the slowness. |
456 channel_disconnected_on_failure_ = true; | 456 channel_disconnected_on_failure_ = true; |
457 LOG(ERROR) << "Disconnecting channel after error!"; | 457 LOG(ERROR) << "Disconnecting channel after error!"; |
458 Disconnect(); | 458 Disconnect(); |
459 } | 459 } |
460 | 460 |
461 return success; | 461 return success; |
462 } | 462 } |
463 | 463 |
464 void AutomationProxy::InvalidateHandle(const IPC::Message& message) { | 464 void AutomationProxy::InvalidateHandle(const IPC::Message& message) { |
465 void* iter = NULL; | 465 PickleIterator iter(message); |
466 int handle; | 466 int handle; |
467 | 467 |
468 if (message.ReadInt(&iter, &handle)) { | 468 if (message.ReadInt(&iter, &handle)) { |
469 tracker_->InvalidateHandle(handle); | 469 tracker_->InvalidateHandle(handle); |
470 } | 470 } |
471 } | 471 } |
472 | 472 |
473 bool AutomationProxy::OpenNewBrowserWindow(Browser::Type type, bool show) { | 473 bool AutomationProxy::OpenNewBrowserWindow(Browser::Type type, bool show) { |
474 return Send( | 474 return Send( |
475 new AutomationMsg_OpenNewBrowserWindowOfType(static_cast<int>(type), | 475 new AutomationMsg_OpenNewBrowserWindowOfType(static_cast<int>(type), |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 } | 583 } |
584 | 584 |
585 bool AutomationProxy::SendJSONRequest(const std::string& request, | 585 bool AutomationProxy::SendJSONRequest(const std::string& request, |
586 int timeout_ms, | 586 int timeout_ms, |
587 std::string* response) { | 587 std::string* response) { |
588 bool result = false; | 588 bool result = false; |
589 if (!SendAutomationJSONRequest(this, request, timeout_ms, response, &result)) | 589 if (!SendAutomationJSONRequest(this, request, timeout_ms, response, &result)) |
590 return false; | 590 return false; |
591 return result; | 591 return result; |
592 } | 592 } |
OLD | NEW |