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" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 return AutomationProvider::Send(msg); | 70 return AutomationProvider::Send(msg); |
71 } | 71 } |
72 | 72 |
73 net::URLRequestJob* TestAutomationProvider::Factory( | 73 net::URLRequestJob* TestAutomationProvider::Factory( |
74 net::URLRequest* request, | 74 net::URLRequest* request, |
75 net::NetworkDelegate* network_delegate, | 75 net::NetworkDelegate* network_delegate, |
76 const std::string& scheme) { | 76 const std::string& scheme) { |
77 if (CFTestsDisabled()) | 77 if (CFTestsDisabled()) |
78 return NULL; | 78 return NULL; |
79 | 79 |
80 if (request->url().SchemeIs("http") || request->url().SchemeIs("https")) { | 80 if (request->url().SchemeIsHTTPOrHTTPS()) { |
81 // Only look at requests that don't have any user data. | 81 // Only look at requests that don't have any user data. |
82 // ResourceDispatcherHost uses the user data for requests that it manages. | 82 // ResourceDispatcherHost uses the user data for requests that it manages. |
83 // We don't want to mess with those. | 83 // We don't want to mess with those. |
84 | 84 |
85 // We could also check if the current thread is our TestUrlRequest thread | 85 // We could also check if the current thread is our TestUrlRequest thread |
86 // and only intercept requests that belong to that thread. | 86 // and only intercept requests that belong to that thread. |
87 if (g_provider_instance_ && request->GetUserData(NULL) == NULL && | 87 if (g_provider_instance_ && request->GetUserData(NULL) == NULL && |
88 g_provider_instance_->tab_handle_ != -1) { | 88 g_provider_instance_->tab_handle_ != -1) { |
89 // We generate our own request id which is also what | 89 // We generate our own request id which is also what |
90 // ResourceDispatcherHost does (well, the id is actually generated by | 90 // ResourceDispatcherHost does (well, the id is actually generated by |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 // static | 129 // static |
130 TestAutomationProvider* TestAutomationProvider::NewAutomationProvider( | 130 TestAutomationProvider* TestAutomationProvider::NewAutomationProvider( |
131 Profile* p, const std::string& channel, | 131 Profile* p, const std::string& channel, |
132 TestAutomationProviderDelegate* delegate) { | 132 TestAutomationProviderDelegate* delegate) { |
133 TestAutomationProvider* automation = new TestAutomationProvider(p, delegate); | 133 TestAutomationProvider* automation = new TestAutomationProvider(p, delegate); |
134 automation->InitializeChannel(channel); | 134 automation->InitializeChannel(channel); |
135 automation->SetExpectedTabCount(1); | 135 automation->SetExpectedTabCount(1); |
136 return automation; | 136 return automation; |
137 } | 137 } |
OLD | NEW |