OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "chrome/browser/browser_thread.h" | 10 #include "chrome/browser/browser_thread.h" |
11 #include "chrome/browser/child_process_security_policy.h" | 11 #include "chrome/browser/child_process_security_policy.h" |
12 #include "chrome/common/chrome_plugin_lib.h" | |
13 #include "chrome/common/render_messages.h" | 12 #include "chrome/common/render_messages.h" |
14 #include "chrome/common/render_messages_params.h" | 13 #include "chrome/common/render_messages_params.h" |
15 #include "chrome/common/resource_response.h" | 14 #include "chrome/common/resource_response.h" |
16 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 15 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
17 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | 16 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
18 #include "content/browser/renderer_host/resource_handler.h" | 17 #include "content/browser/renderer_host/resource_handler.h" |
19 #include "content/browser/renderer_host/resource_message_filter.h" | 18 #include "content/browser/renderer_host/resource_message_filter.h" |
20 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
21 #include "net/base/upload_data.h" | 20 #include "net/base/upload_data.h" |
22 #include "net/http/http_util.h" | 21 #include "net/http/http_util.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 if (!scheme_.empty()) | 184 if (!scheme_.empty()) |
186 net::URLRequest::RegisterProtocolFactory(scheme_, old_factory_); | 185 net::URLRequest::RegisterProtocolFactory(scheme_, old_factory_); |
187 | 186 |
188 DCHECK(test_fixture_ == this); | 187 DCHECK(test_fixture_ == this); |
189 test_fixture_ = NULL; | 188 test_fixture_ = NULL; |
190 | 189 |
191 host_.Shutdown(); | 190 host_.Shutdown(); |
192 | 191 |
193 ChildProcessSecurityPolicy::GetInstance()->Remove(0); | 192 ChildProcessSecurityPolicy::GetInstance()->Remove(0); |
194 | 193 |
195 // The plugin lib is automatically loaded during these test | |
196 // and we want a clean environment for other tests. | |
197 ChromePluginLib::UnloadAllPlugins(); | |
198 | |
199 // Flush the message loop to make Purify happy. | 194 // Flush the message loop to make Purify happy. |
200 message_loop_.RunAllPending(); | 195 message_loop_.RunAllPending(); |
201 } | 196 } |
202 | 197 |
203 // Creates a request using the current test object as the filter. | 198 // Creates a request using the current test object as the filter. |
204 void MakeTestRequest(int render_view_id, | 199 void MakeTestRequest(int render_view_id, |
205 int request_id, | 200 int request_id, |
206 const GURL& url); | 201 const GURL& url); |
207 | 202 |
208 // Generates a request using the given filter. This will probably be a | 203 // Generates a request using the given filter. This will probably be a |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 EXPECT_TRUE(request_info_->replace_extension_localization_templates()); | 1012 EXPECT_TRUE(request_info_->replace_extension_localization_templates()); |
1018 } | 1013 } |
1019 | 1014 |
1020 TEST_F(ApplyExtensionLocalizationFilterTest, GoodSchemeWrongResourceType) { | 1015 TEST_F(ApplyExtensionLocalizationFilterTest, GoodSchemeWrongResourceType) { |
1021 resource_type_ = ResourceType::MAIN_FRAME; | 1016 resource_type_ = ResourceType::MAIN_FRAME; |
1022 ResourceDispatcherHost::ApplyExtensionLocalizationFilter(*url_, | 1017 ResourceDispatcherHost::ApplyExtensionLocalizationFilter(*url_, |
1023 resource_type_, request_info_.get()); | 1018 resource_type_, request_info_.get()); |
1024 | 1019 |
1025 EXPECT_FALSE(request_info_->replace_extension_localization_templates()); | 1020 EXPECT_FALSE(request_info_->replace_extension_localization_templates()); |
1026 } | 1021 } |
OLD | NEW |