| 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" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 io_thread_(content::BrowserThread::IO, &message_loop_), | 175 io_thread_(content::BrowserThread::IO, &message_loop_), |
| 176 profile_manager_(TestingBrowserProcess::GetGlobal()), | 176 profile_manager_(TestingBrowserProcess::GetGlobal()), |
| 177 event_router_(new EventRouterForwarder) {} | 177 event_router_(new EventRouterForwarder) {} |
| 178 | 178 |
| 179 protected: | 179 protected: |
| 180 virtual void SetUp() OVERRIDE { | 180 virtual void SetUp() OVERRIDE { |
| 181 ASSERT_TRUE(profile_manager_.SetUp()); | 181 ASSERT_TRUE(profile_manager_.SetUp()); |
| 182 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 182 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
| 183 &enable_referrers_, NULL, NULL, profile_.GetTestingPrefService()); | 183 &enable_referrers_, NULL, NULL, profile_.GetTestingPrefService()); |
| 184 network_delegate_.reset( | 184 network_delegate_.reset( |
| 185 new ChromeNetworkDelegate(event_router_.get(), &enable_referrers_)); | 185 new ChromeNetworkDelegate(event_router_.get(), &enable_referrers_, |
| 186 false)); |
| 186 network_delegate_->set_profile(&profile_); | 187 network_delegate_->set_profile(&profile_); |
| 187 network_delegate_->set_cookie_settings( | 188 network_delegate_->set_cookie_settings( |
| 188 CookieSettings::Factory::GetForProfile(&profile_)); | 189 CookieSettings::Factory::GetForProfile(&profile_)); |
| 189 context_.reset(new net::TestURLRequestContext(true)); | 190 context_.reset(new net::TestURLRequestContext(true)); |
| 190 context_->set_network_delegate(network_delegate_.get()); | 191 context_->set_network_delegate(network_delegate_.get()); |
| 191 context_->Init(); | 192 context_->Init(); |
| 192 } | 193 } |
| 193 | 194 |
| 194 // Fires a URLRequest with the specified |method|, |content_type| and three | 195 // Fires a URLRequest with the specified |method|, |content_type| and three |
| 195 // elements of upload data: bytes_1, a dummy empty file, bytes_2. | 196 // elements of upload data: bytes_1, a dummy empty file, bytes_2. |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 io_thread_(content::BrowserThread::IO, &message_loop_), | 764 io_thread_(content::BrowserThread::IO, &message_loop_), |
| 764 profile_manager_(TestingBrowserProcess::GetGlobal()), | 765 profile_manager_(TestingBrowserProcess::GetGlobal()), |
| 765 event_router_(new EventRouterForwarder) {} | 766 event_router_(new EventRouterForwarder) {} |
| 766 | 767 |
| 767 protected: | 768 protected: |
| 768 virtual void SetUp() { | 769 virtual void SetUp() { |
| 769 ASSERT_TRUE(profile_manager_.SetUp()); | 770 ASSERT_TRUE(profile_manager_.SetUp()); |
| 770 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 771 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
| 771 &enable_referrers_, NULL, NULL, profile_.GetTestingPrefService()); | 772 &enable_referrers_, NULL, NULL, profile_.GetTestingPrefService()); |
| 772 network_delegate_.reset( | 773 network_delegate_.reset( |
| 773 new ChromeNetworkDelegate(event_router_.get(), &enable_referrers_)); | 774 new ChromeNetworkDelegate(event_router_.get(), &enable_referrers_, |
| 775 false)); |
| 774 network_delegate_->set_profile(&profile_); | 776 network_delegate_->set_profile(&profile_); |
| 775 network_delegate_->set_cookie_settings( | 777 network_delegate_->set_cookie_settings( |
| 776 CookieSettings::Factory::GetForProfile(&profile_)); | 778 CookieSettings::Factory::GetForProfile(&profile_)); |
| 777 context_.reset(new net::TestURLRequestContext(true)); | 779 context_.reset(new net::TestURLRequestContext(true)); |
| 778 host_resolver_.reset(new net::MockHostResolver()); | 780 host_resolver_.reset(new net::MockHostResolver()); |
| 779 host_resolver_->rules()->AddSimulatedFailure("doesnotexist"); | 781 host_resolver_->rules()->AddSimulatedFailure("doesnotexist"); |
| 780 context_->set_host_resolver(host_resolver_.get()); | 782 context_->set_host_resolver(host_resolver_.get()); |
| 781 context_->set_network_delegate(network_delegate_.get()); | 783 context_->set_network_delegate(network_delegate_.get()); |
| 782 context_->Init(); | 784 context_->Init(); |
| 783 } | 785 } |
| (...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2125 EXPECT_TRUE(credentials_set); | 2127 EXPECT_TRUE(credentials_set); |
| 2126 EXPECT_FALSE(auth3.Empty()); | 2128 EXPECT_FALSE(auth3.Empty()); |
| 2127 EXPECT_EQ(username, auth1.username()); | 2129 EXPECT_EQ(username, auth1.username()); |
| 2128 EXPECT_EQ(password, auth1.password()); | 2130 EXPECT_EQ(password, auth1.password()); |
| 2129 EXPECT_EQ(1u, warning_set.size()); | 2131 EXPECT_EQ(1u, warning_set.size()); |
| 2130 EXPECT_TRUE(HasWarning(warning_set, "extid2")); | 2132 EXPECT_TRUE(HasWarning(warning_set, "extid2")); |
| 2131 EXPECT_EQ(3u, capturing_net_log.GetSize()); | 2133 EXPECT_EQ(3u, capturing_net_log.GetSize()); |
| 2132 } | 2134 } |
| 2133 | 2135 |
| 2134 } // namespace extensions | 2136 } // namespace extensions |
| OLD | NEW |