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

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: Move DataUseMeasurement to core 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 profile_manager_(TestingBrowserProcess::GetGlobal()), 190 profile_manager_(TestingBrowserProcess::GetGlobal()),
191 event_router_(new EventRouterForwarder) {} 191 event_router_(new EventRouterForwarder) {}
192 192
193 protected: 193 protected:
194 void SetUp() override { 194 void SetUp() override {
195 ASSERT_TRUE(profile_manager_.SetUp()); 195 ASSERT_TRUE(profile_manager_.SetUp());
196 ChromeNetworkDelegate::InitializePrefsOnUIThread( 196 ChromeNetworkDelegate::InitializePrefsOnUIThread(
197 &enable_referrers_, nullptr, nullptr, nullptr, nullptr, 197 &enable_referrers_, nullptr, nullptr, nullptr, nullptr,
198 profile_.GetTestingPrefService()); 198 profile_.GetTestingPrefService());
199 network_delegate_.reset( 199 network_delegate_.reset(
200 new ChromeNetworkDelegate(event_router_.get(), &enable_referrers_, 200 new ChromeNetworkDelegate(event_router_.get(), &enable_referrers_));
201 metrics::UpdateUsagePrefCallbackType()));
202 network_delegate_->set_profile(&profile_); 201 network_delegate_->set_profile(&profile_);
203 network_delegate_->set_cookie_settings( 202 network_delegate_->set_cookie_settings(
204 CookieSettingsFactory::GetForProfile(&profile_).get()); 203 CookieSettingsFactory::GetForProfile(&profile_).get());
205 context_.reset(new net::TestURLRequestContext(true)); 204 context_.reset(new net::TestURLRequestContext(true));
206 context_->set_network_delegate(network_delegate_.get()); 205 context_->set_network_delegate(network_delegate_.get());
207 context_->Init(); 206 context_->Init();
208 } 207 }
209 208
210 // Fires a URLRequest with the specified |method|, |content_type| and three 209 // Fires a URLRequest with the specified |method|, |content_type| and three
211 // elements of upload data: bytes_1, a dummy empty file, bytes_2. 210 // elements of upload data: bytes_1, a dummy empty file, bytes_2.
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 profile_manager_(TestingBrowserProcess::GetGlobal()), 996 profile_manager_(TestingBrowserProcess::GetGlobal()),
998 event_router_(new EventRouterForwarder) {} 997 event_router_(new EventRouterForwarder) {}
999 998
1000 protected: 999 protected:
1001 void SetUp() override { 1000 void SetUp() override {
1002 ASSERT_TRUE(profile_manager_.SetUp()); 1001 ASSERT_TRUE(profile_manager_.SetUp());
1003 ChromeNetworkDelegate::InitializePrefsOnUIThread( 1002 ChromeNetworkDelegate::InitializePrefsOnUIThread(
1004 &enable_referrers_, nullptr, nullptr, nullptr, nullptr, 1003 &enable_referrers_, nullptr, nullptr, nullptr, nullptr,
1005 profile_.GetTestingPrefService()); 1004 profile_.GetTestingPrefService());
1006 network_delegate_.reset( 1005 network_delegate_.reset(
1007 new ChromeNetworkDelegate(event_router_.get(), &enable_referrers_, 1006 new ChromeNetworkDelegate(event_router_.get(), &enable_referrers_));
1008 metrics::UpdateUsagePrefCallbackType()));
1009 network_delegate_->set_profile(&profile_); 1007 network_delegate_->set_profile(&profile_);
1010 network_delegate_->set_cookie_settings( 1008 network_delegate_->set_cookie_settings(
1011 CookieSettingsFactory::GetForProfile(&profile_).get()); 1009 CookieSettingsFactory::GetForProfile(&profile_).get());
1012 context_.reset(new net::TestURLRequestContext(true)); 1010 context_.reset(new net::TestURLRequestContext(true));
1013 host_resolver_.reset(new net::MockHostResolver()); 1011 host_resolver_.reset(new net::MockHostResolver());
1014 host_resolver_->rules()->AddSimulatedFailure("doesnotexist"); 1012 host_resolver_->rules()->AddSimulatedFailure("doesnotexist");
1015 context_->set_host_resolver(host_resolver_.get()); 1013 context_->set_host_resolver(host_resolver_.get());
1016 context_->set_network_delegate(network_delegate_.get()); 1014 context_->set_network_delegate(network_delegate_.get());
1017 context_->Init(); 1015 context_->Init();
1018 } 1016 }
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
2450 EXPECT_TRUE(credentials_set); 2448 EXPECT_TRUE(credentials_set);
2451 EXPECT_FALSE(auth3.Empty()); 2449 EXPECT_FALSE(auth3.Empty());
2452 EXPECT_EQ(username, auth1.username()); 2450 EXPECT_EQ(username, auth1.username());
2453 EXPECT_EQ(password, auth1.password()); 2451 EXPECT_EQ(password, auth1.password());
2454 EXPECT_EQ(1u, warning_set.size()); 2452 EXPECT_EQ(1u, warning_set.size());
2455 EXPECT_TRUE(HasWarning(warning_set, "extid2")); 2453 EXPECT_TRUE(HasWarning(warning_set, "extid2"));
2456 EXPECT_EQ(3u, capturing_net_log.GetSize()); 2454 EXPECT_EQ(3u, capturing_net_log.GetSize());
2457 } 2455 }
2458 2456
2459 } // namespace extensions 2457 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/io_thread.h » ('j') | chrome/browser/io_thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698