| OLD | NEW |
| 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_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" |
| 11 #include "chrome_frame/test/net/test_automation_resource_message_filter.h" | 11 #include "chrome_frame/test/net/test_automation_resource_message_filter.h" |
| 12 #include "net/url_request/url_request_context.h" |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 | 15 |
| 15 // A special command line switch to just run the unit tests without CF in | 16 // A special command line switch to just run the unit tests without CF in |
| 16 // the picture. Can be useful when the harness itself needs to be debugged. | 17 // the picture. Can be useful when the harness itself needs to be debugged. |
| 17 const char kNoCfTestRun[] = "no-cf-test-run"; | 18 const char kNoCfTestRun[] = "no-cf-test-run"; |
| 18 | 19 |
| 19 bool CFTestsDisabled() { | 20 bool CFTestsDisabled() { |
| 20 static bool switch_present = CommandLine::ForCurrentProcess()-> | 21 static bool switch_present = CommandLine::ForCurrentProcess()-> |
| 21 HasSwitch(kNoCfTestRun); | 22 HasSwitch(kNoCfTestRun); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 if (g_provider_instance_ && request->GetUserData(NULL) == NULL && | 87 if (g_provider_instance_ && request->GetUserData(NULL) == NULL && |
| 87 g_provider_instance_->tab_handle_ != -1) { | 88 g_provider_instance_->tab_handle_ != -1) { |
| 88 // We generate our own request id which is also what | 89 // We generate our own request id which is also what |
| 89 // ResourceDispatcherHost does (well, the id is actually generated by | 90 // ResourceDispatcherHost does (well, the id is actually generated by |
| 90 // ResourceDispatcher). Since these requests are divided into with | 91 // ResourceDispatcher). Since these requests are divided into with |
| 91 // and without userdata, we're OK. However, just to make debugging | 92 // and without userdata, we're OK. However, just to make debugging |
| 92 // a little easier, we have a significantly higher start value. | 93 // a little easier, we have a significantly higher start value. |
| 93 static int new_id = 0x00100000; | 94 static int new_id = 0x00100000; |
| 94 URLRequestAutomationJob* job = new URLRequestAutomationJob( | 95 URLRequestAutomationJob* job = new URLRequestAutomationJob( |
| 95 request, network_delegate, | 96 request, network_delegate, |
| 97 request->context()->http_user_agent_settings(), |
| 96 g_provider_instance_->tab_handle_, new_id++, | 98 g_provider_instance_->tab_handle_, new_id++, |
| 97 g_provider_instance_->automation_resource_message_filter_, false); | 99 g_provider_instance_->automation_resource_message_filter_, false); |
| 98 return job; | 100 return job; |
| 99 } | 101 } |
| 100 } | 102 } |
| 101 | 103 |
| 102 return NULL; | 104 return NULL; |
| 103 } | 105 } |
| 104 | 106 |
| 105 std::string TestAutomationProvider::GetProtocolVersion() { | 107 std::string TestAutomationProvider::GetProtocolVersion() { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 126 | 128 |
| 127 // static | 129 // static |
| 128 TestAutomationProvider* TestAutomationProvider::NewAutomationProvider( | 130 TestAutomationProvider* TestAutomationProvider::NewAutomationProvider( |
| 129 Profile* p, const std::string& channel, | 131 Profile* p, const std::string& channel, |
| 130 TestAutomationProviderDelegate* delegate) { | 132 TestAutomationProviderDelegate* delegate) { |
| 131 TestAutomationProvider* automation = new TestAutomationProvider(p, delegate); | 133 TestAutomationProvider* automation = new TestAutomationProvider(p, delegate); |
| 132 automation->InitializeChannel(channel); | 134 automation->InitializeChannel(channel); |
| 133 automation->SetExpectedTabCount(1); | 135 automation->SetExpectedTabCount(1); |
| 134 return automation; | 136 return automation; |
| 135 } | 137 } |
| OLD | NEW |