| 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/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 io_thread_(content::BrowserThread::IO, &message_loop_) {} | 156 io_thread_(content::BrowserThread::IO, &message_loop_) {} |
| 157 | 157 |
| 158 protected: | 158 protected: |
| 159 virtual void SetUp() OVERRIDE { | 159 virtual void SetUp() OVERRIDE { |
| 160 event_router_ = new extensions::EventRouterForwarder(); | 160 event_router_ = new extensions::EventRouterForwarder(); |
| 161 enable_referrers_.Init( | 161 enable_referrers_.Init( |
| 162 prefs::kEnableReferrers, profile_.GetTestingPrefService(), NULL); | 162 prefs::kEnableReferrers, profile_.GetTestingPrefService(), NULL); |
| 163 network_delegate_.reset(new ChromeNetworkDelegate( | 163 network_delegate_.reset(new ChromeNetworkDelegate( |
| 164 event_router_.get(), NULL, NULL, NULL, &profile_, | 164 event_router_.get(), NULL, NULL, NULL, &profile_, |
| 165 CookieSettings::Factory::GetForProfile(&profile_), &enable_referrers_, | 165 CookieSettings::Factory::GetForProfile(&profile_), &enable_referrers_, |
| 166 NULL, NULL)); | 166 NULL, NULL, NULL)); |
| 167 context_.reset(new TestURLRequestContext(true)); | 167 context_.reset(new TestURLRequestContext(true)); |
| 168 context_->set_network_delegate(network_delegate_.get()); | 168 context_->set_network_delegate(network_delegate_.get()); |
| 169 context_->Init(); | 169 context_->Init(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 // Fires a URLRequest with the specified |method|, |content_type| and three | 172 // Fires a URLRequest with the specified |method|, |content_type| and three |
| 173 // elements of upload data: bytes_1, a dummy empty file, bytes_2. | 173 // elements of upload data: bytes_1, a dummy empty file, bytes_2. |
| 174 void FireURLRequestWithData(const std::string& method, | 174 void FireURLRequestWithData(const std::string& method, |
| 175 const char* content_type, | 175 const char* content_type, |
| 176 const std::vector<char>& bytes_1, | 176 const std::vector<char>& bytes_1, |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 io_thread_(content::BrowserThread::IO, &message_loop_) {} | 699 io_thread_(content::BrowserThread::IO, &message_loop_) {} |
| 700 | 700 |
| 701 protected: | 701 protected: |
| 702 virtual void SetUp() { | 702 virtual void SetUp() { |
| 703 event_router_ = new extensions::EventRouterForwarder(); | 703 event_router_ = new extensions::EventRouterForwarder(); |
| 704 enable_referrers_.Init( | 704 enable_referrers_.Init( |
| 705 prefs::kEnableReferrers, profile_.GetTestingPrefService(), NULL); | 705 prefs::kEnableReferrers, profile_.GetTestingPrefService(), NULL); |
| 706 network_delegate_.reset(new ChromeNetworkDelegate( | 706 network_delegate_.reset(new ChromeNetworkDelegate( |
| 707 event_router_.get(), NULL, NULL, NULL, &profile_, | 707 event_router_.get(), NULL, NULL, NULL, &profile_, |
| 708 CookieSettings::Factory::GetForProfile(&profile_), &enable_referrers_, | 708 CookieSettings::Factory::GetForProfile(&profile_), &enable_referrers_, |
| 709 NULL, NULL)); | 709 NULL, NULL, NULL)); |
| 710 context_.reset(new TestURLRequestContext(true)); | 710 context_.reset(new TestURLRequestContext(true)); |
| 711 host_resolver_.reset(new net::MockHostResolver()); | 711 host_resolver_.reset(new net::MockHostResolver()); |
| 712 host_resolver_->rules()->AddSimulatedFailure("doesnotexist"); | 712 host_resolver_->rules()->AddSimulatedFailure("doesnotexist"); |
| 713 context_->set_host_resolver(host_resolver_.get()); | 713 context_->set_host_resolver(host_resolver_.get()); |
| 714 context_->set_network_delegate(network_delegate_.get()); | 714 context_->set_network_delegate(network_delegate_.get()); |
| 715 context_->Init(); | 715 context_->Init(); |
| 716 } | 716 } |
| 717 | 717 |
| 718 MessageLoopForIO message_loop_; | 718 MessageLoopForIO message_loop_; |
| 719 content::TestBrowserThread ui_thread_; | 719 content::TestBrowserThread ui_thread_; |
| (...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2066 credentials_set = MergeOnAuthRequiredResponses( | 2066 credentials_set = MergeOnAuthRequiredResponses( |
| 2067 deltas, &auth3, &conflicting_extensions, &net_log); | 2067 deltas, &auth3, &conflicting_extensions, &net_log); |
| 2068 EXPECT_TRUE(credentials_set); | 2068 EXPECT_TRUE(credentials_set); |
| 2069 EXPECT_FALSE(auth3.Empty()); | 2069 EXPECT_FALSE(auth3.Empty()); |
| 2070 EXPECT_EQ(username, auth1.username()); | 2070 EXPECT_EQ(username, auth1.username()); |
| 2071 EXPECT_EQ(password, auth1.password()); | 2071 EXPECT_EQ(password, auth1.password()); |
| 2072 EXPECT_EQ(1u, conflicting_extensions.size()); | 2072 EXPECT_EQ(1u, conflicting_extensions.size()); |
| 2073 EXPECT_TRUE(ContainsKey(conflicting_extensions, "extid2")); | 2073 EXPECT_TRUE(ContainsKey(conflicting_extensions, "extid2")); |
| 2074 EXPECT_EQ(3u, capturing_net_log.GetSize()); | 2074 EXPECT_EQ(3u, capturing_net_log.GetSize()); |
| 2075 } | 2075 } |
| OLD | NEW |