| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 io_thread_(content::BrowserThread::IO, &message_loop_) {} | 152 io_thread_(content::BrowserThread::IO, &message_loop_) {} |
| 153 | 153 |
| 154 protected: | 154 protected: |
| 155 virtual void SetUp() OVERRIDE { | 155 virtual void SetUp() OVERRIDE { |
| 156 event_router_ = new extensions::EventRouterForwarder(); | 156 event_router_ = new extensions::EventRouterForwarder(); |
| 157 enable_referrers_.Init( | 157 enable_referrers_.Init( |
| 158 prefs::kEnableReferrers, profile_.GetTestingPrefService(), NULL); | 158 prefs::kEnableReferrers, profile_.GetTestingPrefService(), NULL); |
| 159 network_delegate_.reset(new ChromeNetworkDelegate( | 159 network_delegate_.reset(new ChromeNetworkDelegate( |
| 160 event_router_.get(), NULL, NULL, NULL, &profile_, | 160 event_router_.get(), NULL, NULL, NULL, &profile_, |
| 161 CookieSettings::Factory::GetForProfile(&profile_), &enable_referrers_, | 161 CookieSettings::Factory::GetForProfile(&profile_), &enable_referrers_, |
| 162 NULL)); | 162 NULL, NULL)); |
| 163 context_.reset(new TestURLRequestContext(true)); | 163 context_.reset(new TestURLRequestContext(true)); |
| 164 context_->set_network_delegate(network_delegate_.get()); | 164 context_->set_network_delegate(network_delegate_.get()); |
| 165 context_->Init(); | 165 context_->Init(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 // Fires a URLRequest with the specified |method|, |content_type| and three | 168 // Fires a URLRequest with the specified |method|, |content_type| and three |
| 169 // elements of upload data: bytes_1, a dummy empty file, bytes_2. | 169 // elements of upload data: bytes_1, a dummy empty file, bytes_2. |
| 170 void FireURLRequestWithData(const std::string& method, | 170 void FireURLRequestWithData(const std::string& method, |
| 171 const char* content_type, | 171 const char* content_type, |
| 172 const std::vector<char>& bytes_1, | 172 const std::vector<char>& bytes_1, |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 io_thread_(content::BrowserThread::IO, &message_loop_) {} | 696 io_thread_(content::BrowserThread::IO, &message_loop_) {} |
| 697 | 697 |
| 698 protected: | 698 protected: |
| 699 virtual void SetUp() { | 699 virtual void SetUp() { |
| 700 event_router_ = new extensions::EventRouterForwarder(); | 700 event_router_ = new extensions::EventRouterForwarder(); |
| 701 enable_referrers_.Init( | 701 enable_referrers_.Init( |
| 702 prefs::kEnableReferrers, profile_.GetTestingPrefService(), NULL); | 702 prefs::kEnableReferrers, profile_.GetTestingPrefService(), NULL); |
| 703 network_delegate_.reset(new ChromeNetworkDelegate( | 703 network_delegate_.reset(new ChromeNetworkDelegate( |
| 704 event_router_.get(), NULL, NULL, NULL, &profile_, | 704 event_router_.get(), NULL, NULL, NULL, &profile_, |
| 705 CookieSettings::Factory::GetForProfile(&profile_), &enable_referrers_, | 705 CookieSettings::Factory::GetForProfile(&profile_), &enable_referrers_, |
| 706 NULL)); | 706 NULL, NULL)); |
| 707 context_.reset(new TestURLRequestContext(true)); | 707 context_.reset(new TestURLRequestContext(true)); |
| 708 host_resolver_.reset(new net::MockHostResolver()); | 708 host_resolver_.reset(new net::MockHostResolver()); |
| 709 host_resolver_->rules()->AddSimulatedFailure("doesnotexist"); | 709 host_resolver_->rules()->AddSimulatedFailure("doesnotexist"); |
| 710 context_->set_host_resolver(host_resolver_.get()); | 710 context_->set_host_resolver(host_resolver_.get()); |
| 711 context_->set_network_delegate(network_delegate_.get()); | 711 context_->set_network_delegate(network_delegate_.get()); |
| 712 context_->Init(); | 712 context_->Init(); |
| 713 } | 713 } |
| 714 | 714 |
| 715 MessageLoopForIO message_loop_; | 715 MessageLoopForIO message_loop_; |
| 716 content::TestBrowserThread ui_thread_; | 716 content::TestBrowserThread ui_thread_; |
| (...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1896 credentials_set = MergeOnAuthRequiredResponses( | 1896 credentials_set = MergeOnAuthRequiredResponses( |
| 1897 deltas, &auth3, &conflicting_extensions, &net_log); | 1897 deltas, &auth3, &conflicting_extensions, &net_log); |
| 1898 EXPECT_TRUE(credentials_set); | 1898 EXPECT_TRUE(credentials_set); |
| 1899 EXPECT_FALSE(auth3.Empty()); | 1899 EXPECT_FALSE(auth3.Empty()); |
| 1900 EXPECT_EQ(username, auth1.username()); | 1900 EXPECT_EQ(username, auth1.username()); |
| 1901 EXPECT_EQ(password, auth1.password()); | 1901 EXPECT_EQ(password, auth1.password()); |
| 1902 EXPECT_EQ(1u, conflicting_extensions.size()); | 1902 EXPECT_EQ(1u, conflicting_extensions.size()); |
| 1903 EXPECT_TRUE(ContainsKey(conflicting_extensions, "extid2")); | 1903 EXPECT_TRUE(ContainsKey(conflicting_extensions, "extid2")); |
| 1904 EXPECT_EQ(3u, capturing_net_log.GetSize()); | 1904 EXPECT_EQ(3u, capturing_net_log.GetSize()); |
| 1905 } | 1905 } |
| OLD | NEW |