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

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

Issue 5978003: Make IPC::Channel::Listener:OnMessageReceived have a return value indicating ... (Closed) Base URL: svn://chrome-svn/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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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
(...skipping 24 matching lines...) Expand all
35 // This object allows messages received on the background thread to be 35 // This object allows messages received on the background thread to be
36 // properly triaged. 36 // properly triaged.
37 class AutomationMessageFilter : public IPC::ChannelProxy::MessageFilter { 37 class AutomationMessageFilter : public IPC::ChannelProxy::MessageFilter {
38 public: 38 public:
39 explicit AutomationMessageFilter(AutomationProxy* server) : server_(server) {} 39 explicit AutomationMessageFilter(AutomationProxy* server) : server_(server) {}
40 40
41 // Return true to indicate that the message was handled, or false to let 41 // Return true to indicate that the message was handled, or false to let
42 // the message be handled in the default way. 42 // the message be handled in the default way.
43 virtual bool OnMessageReceived(const IPC::Message& message) { 43 virtual bool OnMessageReceived(const IPC::Message& message) {
44 bool handled = true; 44 bool handled = true;
45
46 IPC_BEGIN_MESSAGE_MAP(AutomationMessageFilter, message) 45 IPC_BEGIN_MESSAGE_MAP(AutomationMessageFilter, message)
47 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_Hello, 46 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_Hello,
48 OnAutomationHello(message)); 47 OnAutomationHello(message))
49 IPC_MESSAGE_HANDLER_GENERIC( 48 IPC_MESSAGE_HANDLER_GENERIC(
50 AutomationMsg_InitialLoadsComplete, server_->SignalInitialLoads()); 49 AutomationMsg_InitialLoadsComplete, server_->SignalInitialLoads())
51 IPC_MESSAGE_HANDLER(AutomationMsg_InitialNewTabUILoadComplete, 50 IPC_MESSAGE_HANDLER(AutomationMsg_InitialNewTabUILoadComplete,
52 NewTabLoaded); 51 NewTabLoaded)
53 IPC_MESSAGE_HANDLER_GENERIC( 52 IPC_MESSAGE_HANDLER_GENERIC(
54 AutomationMsg_InvalidateHandle, server_->InvalidateHandle(message)); 53 AutomationMsg_InvalidateHandle, server_->InvalidateHandle(message))
55 IPC_MESSAGE_UNHANDLED(handled = false); 54 IPC_MESSAGE_UNHANDLED(handled = false)
56 IPC_END_MESSAGE_MAP() 55 IPC_END_MESSAGE_MAP()
57 56
58 return handled; 57 return handled;
59 } 58 }
60 59
61 virtual void OnFilterAdded(IPC::Channel* channel) { 60 virtual void OnFilterAdded(IPC::Channel* channel) {
62 server_->SetChannel(channel); 61 server_->SetChannel(channel);
63 } 62 }
64 63
65 virtual void OnFilterRemoved() { 64 virtual void OnFilterRemoved() {
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 bool AutomationProxy::SendProxyConfig(const std::string& new_proxy_config) { 371 bool AutomationProxy::SendProxyConfig(const std::string& new_proxy_config) {
373 return Send(new AutomationMsg_SetProxyConfig(new_proxy_config)); 372 return Send(new AutomationMsg_SetProxyConfig(new_proxy_config));
374 } 373 }
375 374
376 void AutomationProxy::Disconnect() { 375 void AutomationProxy::Disconnect() {
377 DCHECK(shutdown_event_.get() != NULL); 376 DCHECK(shutdown_event_.get() != NULL);
378 shutdown_event_->Signal(); 377 shutdown_event_->Signal();
379 channel_.reset(); 378 channel_.reset();
380 } 379 }
381 380
382 void AutomationProxy::OnMessageReceived(const IPC::Message& msg) { 381 bool AutomationProxy::OnMessageReceived(const IPC::Message& msg) {
383 // This won't get called unless AutomationProxy is run from 382 // This won't get called unless AutomationProxy is run from
384 // inside a message loop. 383 // inside a message loop.
385 NOTREACHED(); 384 NOTREACHED();
385 return false;
386 } 386 }
387 387
388 void AutomationProxy::OnChannelError() { 388 void AutomationProxy::OnChannelError() {
389 LOG(ERROR) << "Channel error in AutomationProxy."; 389 LOG(ERROR) << "Channel error in AutomationProxy.";
390 if (disconnect_on_failure_) 390 if (disconnect_on_failure_)
391 Disconnect(); 391 Disconnect();
392 } 392 }
393 393
394 scoped_refptr<WindowProxy> AutomationProxy::GetActiveWindow() { 394 scoped_refptr<WindowProxy> AutomationProxy::GetActiveWindow() {
395 int handle = 0; 395 int handle = 0;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 password, 540 password,
541 &success)); 541 &success));
542 // If message sending unsuccessful or test failed, return false. 542 // If message sending unsuccessful or test failed, return false.
543 return sent && success; 543 return sent && success;
544 } 544 }
545 #endif 545 #endif
546 546
547 bool AutomationProxy::ResetToDefaultTheme() { 547 bool AutomationProxy::ResetToDefaultTheme() {
548 return Send(new AutomationMsg_ResetToDefaultTheme()); 548 return Send(new AutomationMsg_ResetToDefaultTheme());
549 } 549 }
OLDNEW
« no previous file with comments | « chrome/test/automation/automation_proxy.h ('k') | chrome/test/automation/automation_proxy_uitest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698