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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 io_thread_(content::BrowserThread::IO, &message_loop_) {} | 700 io_thread_(content::BrowserThread::IO, &message_loop_) {} |
701 | 701 |
702 protected: | 702 protected: |
703 virtual void SetUp() { | 703 virtual void SetUp() { |
704 event_router_ = new extensions::EventRouterForwarder(); | 704 event_router_ = new extensions::EventRouterForwarder(); |
705 enable_referrers_.Init( | 705 enable_referrers_.Init( |
706 prefs::kEnableReferrers, profile_.GetTestingPrefService(), NULL); | 706 prefs::kEnableReferrers, profile_.GetTestingPrefService(), NULL); |
707 network_delegate_.reset(new ChromeNetworkDelegate( | 707 network_delegate_.reset(new ChromeNetworkDelegate( |
708 event_router_.get(), NULL, NULL, NULL, &profile_, | 708 event_router_.get(), NULL, NULL, NULL, &profile_, |
709 CookieSettings::Factory::GetForProfile(&profile_), &enable_referrers_, | 709 CookieSettings::Factory::GetForProfile(&profile_), &enable_referrers_, |
710 NULL, NULL)); | 710 NULL, NULL, NULL)); |
711 context_.reset(new TestURLRequestContext(true)); | 711 context_.reset(new TestURLRequestContext(true)); |
712 host_resolver_.reset(new net::MockHostResolver()); | 712 host_resolver_.reset(new net::MockHostResolver()); |
713 host_resolver_->rules()->AddSimulatedFailure("doesnotexist"); | 713 host_resolver_->rules()->AddSimulatedFailure("doesnotexist"); |
714 context_->set_host_resolver(host_resolver_.get()); | 714 context_->set_host_resolver(host_resolver_.get()); |
715 context_->set_network_delegate(network_delegate_.get()); | 715 context_->set_network_delegate(network_delegate_.get()); |
716 context_->Init(); | 716 context_->Init(); |
717 } | 717 } |
718 | 718 |
719 MessageLoopForIO message_loop_; | 719 MessageLoopForIO message_loop_; |
720 content::TestBrowserThread ui_thread_; | 720 content::TestBrowserThread ui_thread_; |
(...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2067 credentials_set = MergeOnAuthRequiredResponses( | 2067 credentials_set = MergeOnAuthRequiredResponses( |
2068 deltas, &auth3, &conflicting_extensions, &net_log); | 2068 deltas, &auth3, &conflicting_extensions, &net_log); |
2069 EXPECT_TRUE(credentials_set); | 2069 EXPECT_TRUE(credentials_set); |
2070 EXPECT_FALSE(auth3.Empty()); | 2070 EXPECT_FALSE(auth3.Empty()); |
2071 EXPECT_EQ(username, auth1.username()); | 2071 EXPECT_EQ(username, auth1.username()); |
2072 EXPECT_EQ(password, auth1.password()); | 2072 EXPECT_EQ(password, auth1.password()); |
2073 EXPECT_EQ(1u, conflicting_extensions.size()); | 2073 EXPECT_EQ(1u, conflicting_extensions.size()); |
2074 EXPECT_TRUE(ContainsKey(conflicting_extensions, "extid2")); | 2074 EXPECT_TRUE(ContainsKey(conflicting_extensions, "extid2")); |
2075 EXPECT_EQ(3u, capturing_net_log.GetSize()); | 2075 EXPECT_EQ(3u, capturing_net_log.GetSize()); |
2076 } | 2076 } |
OLD | NEW |