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 <map> | 5 #include <map> |
6 #include <queue> | 6 #include <queue> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
13 #include "base/json/json_string_value_serializer.h" | 13 #include "base/json/json_string_value_serializer.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/prefs/pref_member.h" | 17 #include "base/prefs/pref_member.h" |
18 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
19 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
20 #include "base/strings/string_piece.h" | 20 #include "base/strings/string_piece.h" |
21 #include "base/strings/string_split.h" | 21 #include "base/strings/string_split.h" |
22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
24 #include "base/thread_task_runner_handle.h" | 24 #include "base/thread_task_runner_handle.h" |
25 #include "base/time/time.h" | 25 #include "base/time/time.h" |
26 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 26 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
27 #include "chrome/browser/extensions/event_router_forwarder.h" | 27 #include "chrome/browser/extensions/event_router_forwarder.h" |
28 #include "chrome/browser/net/about_protocol_handler.h" | |
29 #include "chrome/browser/net/chrome_network_delegate.h" | 28 #include "chrome/browser/net/chrome_network_delegate.h" |
30 #include "chrome/test/base/testing_browser_process.h" | 29 #include "chrome/test/base/testing_browser_process.h" |
31 #include "chrome/test/base/testing_pref_service_syncable.h" | 30 #include "chrome/test/base/testing_pref_service_syncable.h" |
32 #include "chrome/test/base/testing_profile.h" | 31 #include "chrome/test/base/testing_profile.h" |
33 #include "chrome/test/base/testing_profile_manager.h" | 32 #include "chrome/test/base/testing_profile_manager.h" |
| 33 #include "components/about_handler/about_protocol_handler.h" |
34 #include "components/content_settings/core/browser/cookie_settings.h" | 34 #include "components/content_settings/core/browser/cookie_settings.h" |
35 #include "content/public/common/url_constants.h" | 35 #include "content/public/common/url_constants.h" |
36 #include "content/public/test/test_browser_thread_bundle.h" | 36 #include "content/public/test/test_browser_thread_bundle.h" |
37 #include "extensions/browser/api/web_request/upload_data_presenter.h" | 37 #include "extensions/browser/api/web_request/upload_data_presenter.h" |
38 #include "extensions/browser/api/web_request/web_request_api.h" | 38 #include "extensions/browser/api/web_request/web_request_api.h" |
39 #include "extensions/browser/api/web_request/web_request_api_constants.h" | 39 #include "extensions/browser/api/web_request/web_request_api_constants.h" |
40 #include "extensions/browser/api/web_request/web_request_api_helpers.h" | 40 #include "extensions/browser/api/web_request/web_request_api_helpers.h" |
41 #include "extensions/browser/warning_set.h" | 41 #include "extensions/browser/warning_set.h" |
42 #include "extensions/common/api/web_request.h" | 42 #include "extensions/common/api/web_request.h" |
43 #include "extensions/common/extension_messages.h" | 43 #include "extensions/common/extension_messages.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 kEventName + "/1", filter, | 231 kEventName + "/1", filter, |
232 ExtensionWebRequestEventRouter::ExtraInfoSpec::BLOCKING, 0, 0, | 232 ExtensionWebRequestEventRouter::ExtraInfoSpec::BLOCKING, 0, 0, |
233 ipc_sender_factory.GetWeakPtr()); | 233 ipc_sender_factory.GetWeakPtr()); |
234 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( | 234 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( |
235 &profile_, extension2_id, extension2_id, events::FOR_TEST, kEventName, | 235 &profile_, extension2_id, extension2_id, events::FOR_TEST, kEventName, |
236 kEventName + "/2", filter, | 236 kEventName + "/2", filter, |
237 ExtensionWebRequestEventRouter::ExtraInfoSpec::BLOCKING, 0, 0, | 237 ExtensionWebRequestEventRouter::ExtraInfoSpec::BLOCKING, 0, 0, |
238 ipc_sender_factory.GetWeakPtr()); | 238 ipc_sender_factory.GetWeakPtr()); |
239 | 239 |
240 net::URLRequestJobFactoryImpl job_factory; | 240 net::URLRequestJobFactoryImpl job_factory; |
241 job_factory.SetProtocolHandler( | 241 job_factory.SetProtocolHandler(url::kAboutScheme, |
242 url::kAboutScheme, new chrome_browser_net::AboutProtocolHandler()); | 242 new about_handler::AboutProtocolHandler()); |
243 context_->set_job_factory(&job_factory); | 243 context_->set_job_factory(&job_factory); |
244 | 244 |
245 GURL redirect_url("about:redirected"); | 245 GURL redirect_url("about:redirected"); |
246 GURL not_chosen_redirect_url("about:not_chosen"); | 246 GURL not_chosen_redirect_url("about:not_chosen"); |
247 | 247 |
248 scoped_ptr<net::URLRequest> request(context_->CreateRequest( | 248 scoped_ptr<net::URLRequest> request(context_->CreateRequest( |
249 GURL("about:blank"), net::DEFAULT_PRIORITY, &delegate_)); | 249 GURL("about:blank"), net::DEFAULT_PRIORITY, &delegate_)); |
250 { | 250 { |
251 // onBeforeRequest will be dispatched twice initially. The second response - | 251 // onBeforeRequest will be dispatched twice initially. The second response - |
252 // the redirect - should win, since it has a later |install_time|. The | 252 // the redirect - should win, since it has a later |install_time|. The |
(...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2246 EXPECT_TRUE(credentials_set); | 2246 EXPECT_TRUE(credentials_set); |
2247 EXPECT_FALSE(auth3.Empty()); | 2247 EXPECT_FALSE(auth3.Empty()); |
2248 EXPECT_EQ(username, auth1.username()); | 2248 EXPECT_EQ(username, auth1.username()); |
2249 EXPECT_EQ(password, auth1.password()); | 2249 EXPECT_EQ(password, auth1.password()); |
2250 EXPECT_EQ(1u, warning_set.size()); | 2250 EXPECT_EQ(1u, warning_set.size()); |
2251 EXPECT_TRUE(HasWarning(warning_set, "extid2")); | 2251 EXPECT_TRUE(HasWarning(warning_set, "extid2")); |
2252 EXPECT_EQ(3u, capturing_net_log.GetSize()); | 2252 EXPECT_EQ(3u, capturing_net_log.GetSize()); |
2253 } | 2253 } |
2254 | 2254 |
2255 } // namespace extensions | 2255 } // namespace extensions |
OLD | NEW |