Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_api_unittest.cc

Issue 2462983003: Move data use measurement to DataUseNetworkDelegate (Closed)
Patch Set: Rebased and fixed nits Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <queue> 10 #include <queue>
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 profile_manager_(TestingBrowserProcess::GetGlobal()), 186 profile_manager_(TestingBrowserProcess::GetGlobal()),
187 event_router_(new EventRouterForwarder) {} 187 event_router_(new EventRouterForwarder) {}
188 188
189 protected: 189 protected:
190 void SetUp() override { 190 void SetUp() override {
191 ASSERT_TRUE(profile_manager_.SetUp()); 191 ASSERT_TRUE(profile_manager_.SetUp());
192 ChromeNetworkDelegate::InitializePrefsOnUIThread( 192 ChromeNetworkDelegate::InitializePrefsOnUIThread(
193 &enable_referrers_, nullptr, nullptr, nullptr, nullptr, 193 &enable_referrers_, nullptr, nullptr, nullptr, nullptr,
194 profile_.GetTestingPrefService()); 194 profile_.GetTestingPrefService());
195 network_delegate_.reset( 195 network_delegate_.reset(
196 new ChromeNetworkDelegate(event_router_.get(), &enable_referrers_, 196 new ChromeNetworkDelegate(event_router_.get(), &enable_referrers_));
197 metrics::UpdateUsagePrefCallbackType()));
198 network_delegate_->set_profile(&profile_); 197 network_delegate_->set_profile(&profile_);
199 network_delegate_->set_cookie_settings( 198 network_delegate_->set_cookie_settings(
200 CookieSettingsFactory::GetForProfile(&profile_).get()); 199 CookieSettingsFactory::GetForProfile(&profile_).get());
201 context_.reset(new net::TestURLRequestContext(true)); 200 context_.reset(new net::TestURLRequestContext(true));
202 context_->set_network_delegate(network_delegate_.get()); 201 context_->set_network_delegate(network_delegate_.get());
203 context_->Init(); 202 context_->Init();
204 } 203 }
205 204
206 // Fires a URLRequest with the specified |method|, |content_type| and three 205 // Fires a URLRequest with the specified |method|, |content_type| and three
207 // elements of upload data: bytes_1, a dummy empty file, bytes_2. 206 // elements of upload data: bytes_1, a dummy empty file, bytes_2.
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 profile_manager_(TestingBrowserProcess::GetGlobal()), 992 profile_manager_(TestingBrowserProcess::GetGlobal()),
994 event_router_(new EventRouterForwarder) {} 993 event_router_(new EventRouterForwarder) {}
995 994
996 protected: 995 protected:
997 void SetUp() override { 996 void SetUp() override {
998 ASSERT_TRUE(profile_manager_.SetUp()); 997 ASSERT_TRUE(profile_manager_.SetUp());
999 ChromeNetworkDelegate::InitializePrefsOnUIThread( 998 ChromeNetworkDelegate::InitializePrefsOnUIThread(
1000 &enable_referrers_, nullptr, nullptr, nullptr, nullptr, 999 &enable_referrers_, nullptr, nullptr, nullptr, nullptr,
1001 profile_.GetTestingPrefService()); 1000 profile_.GetTestingPrefService());
1002 network_delegate_.reset( 1001 network_delegate_.reset(
1003 new ChromeNetworkDelegate(event_router_.get(), &enable_referrers_, 1002 new ChromeNetworkDelegate(event_router_.get(), &enable_referrers_));
1004 metrics::UpdateUsagePrefCallbackType()));
1005 network_delegate_->set_profile(&profile_); 1003 network_delegate_->set_profile(&profile_);
1006 network_delegate_->set_cookie_settings( 1004 network_delegate_->set_cookie_settings(
1007 CookieSettingsFactory::GetForProfile(&profile_).get()); 1005 CookieSettingsFactory::GetForProfile(&profile_).get());
1008 context_.reset(new net::TestURLRequestContext(true)); 1006 context_.reset(new net::TestURLRequestContext(true));
1009 host_resolver_.reset(new net::MockHostResolver()); 1007 host_resolver_.reset(new net::MockHostResolver());
1010 host_resolver_->rules()->AddSimulatedFailure("doesnotexist"); 1008 host_resolver_->rules()->AddSimulatedFailure("doesnotexist");
1011 context_->set_host_resolver(host_resolver_.get()); 1009 context_->set_host_resolver(host_resolver_.get());
1012 context_->set_network_delegate(network_delegate_.get()); 1010 context_->set_network_delegate(network_delegate_.get());
1013 context_->Init(); 1011 context_->Init();
1014 } 1012 }
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
2442 EXPECT_TRUE(credentials_set); 2440 EXPECT_TRUE(credentials_set);
2443 EXPECT_FALSE(auth3.Empty()); 2441 EXPECT_FALSE(auth3.Empty());
2444 EXPECT_EQ(username, auth1.username()); 2442 EXPECT_EQ(username, auth1.username());
2445 EXPECT_EQ(password, auth1.password()); 2443 EXPECT_EQ(password, auth1.password());
2446 EXPECT_EQ(1u, warning_set.size()); 2444 EXPECT_EQ(1u, warning_set.size());
2447 EXPECT_TRUE(HasWarning(warning_set, "extid2")); 2445 EXPECT_TRUE(HasWarning(warning_set, "extid2"));
2448 EXPECT_EQ(3u, capturing_net_log.GetSize()); 2446 EXPECT_EQ(3u, capturing_net_log.GetSize());
2449 } 2447 }
2450 2448
2451 } // namespace extensions 2449 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/data_use_measurement/chrome_data_use_ascriber.cc ('k') | chrome/browser/io_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698