| OLD | NEW |
| 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_frame/test/net/test_automation_provider.h" | 5 #include "chrome_frame/test/net/test_automation_provider.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "chrome/common/automation_messages.h" | 10 #include "chrome/common/automation_messages.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 TestAutomationProvider::Factory); | 41 TestAutomationProvider::Factory); |
| 42 automation_resource_message_filter_ = | 42 automation_resource_message_filter_ = |
| 43 new TestAutomationResourceMessageFilter(this); | 43 new TestAutomationResourceMessageFilter(this); |
| 44 g_provider_instance_ = this; | 44 g_provider_instance_ = this; |
| 45 } | 45 } |
| 46 | 46 |
| 47 TestAutomationProvider::~TestAutomationProvider() { | 47 TestAutomationProvider::~TestAutomationProvider() { |
| 48 g_provider_instance_ = NULL; | 48 g_provider_instance_ = NULL; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void TestAutomationProvider::OnMessageReceived(const IPC::Message& msg) { | 51 bool TestAutomationProvider::OnMessageReceived(const IPC::Message& msg) { |
| 52 if (automation_resource_message_filter_->OnMessageReceived(msg)) | 52 if (automation_resource_message_filter_->OnMessageReceived(msg)) |
| 53 return; // Message handled by the filter. | 53 return true; // Message handled by the filter. |
| 54 | 54 |
| 55 __super::OnMessageReceived(msg); | 55 return __super::OnMessageReceived(msg); |
| 56 } | 56 } |
| 57 | 57 |
| 58 // IPC override to grab the tab handle. | 58 // IPC override to grab the tab handle. |
| 59 bool TestAutomationProvider::Send(IPC::Message* msg) { | 59 bool TestAutomationProvider::Send(IPC::Message* msg) { |
| 60 if (msg->type() == AutomationMsg_TabLoaded::ID) { | 60 if (msg->type() == AutomationMsg_TabLoaded::ID) { |
| 61 DCHECK(tab_handle_ == -1) << "Currently only support one tab"; | 61 DCHECK(tab_handle_ == -1) << "Currently only support one tab"; |
| 62 void* iter = NULL; | 62 void* iter = NULL; |
| 63 CHECK(msg->ReadInt(&iter, &tab_handle_)); | 63 CHECK(msg->ReadInt(&iter, &tab_handle_)); |
| 64 DVLOG(1) << "Got tab handle: " << tab_handle_; | 64 DVLOG(1) << "Got tab handle: " << tab_handle_; |
| 65 DCHECK(tab_handle_ != -1 && tab_handle_ != 0); | 65 DCHECK(tab_handle_ != -1 && tab_handle_ != 0); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 // static | 117 // static |
| 118 TestAutomationProvider* TestAutomationProvider::NewAutomationProvider( | 118 TestAutomationProvider* TestAutomationProvider::NewAutomationProvider( |
| 119 Profile* p, const std::string& channel, | 119 Profile* p, const std::string& channel, |
| 120 TestAutomationProviderDelegate* delegate) { | 120 TestAutomationProviderDelegate* delegate) { |
| 121 TestAutomationProvider* automation = new TestAutomationProvider(p, delegate); | 121 TestAutomationProvider* automation = new TestAutomationProvider(p, delegate); |
| 122 automation->InitializeChannel(channel); | 122 automation->InitializeChannel(channel); |
| 123 automation->SetExpectedTabCount(1); | 123 automation->SetExpectedTabCount(1); |
| 124 return automation; | 124 return automation; |
| 125 } | 125 } |
| OLD | NEW |