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

Side by Side Diff: chrome/browser/net/chrome_network_delegate_unittest.cc

Issue 2358663004: Fix foregound vs background data use measurement (Closed)
Patch Set: Addressed bengr comments Created 4 years, 2 months 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 "chrome/browser/net/chrome_network_delegate.h" 5 #include "chrome/browser/net/chrome_network_delegate.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 GURL("http://example.com"), net::DEFAULT_PRIORITY, &test_delegate)); 84 GURL("http://example.com"), net::DEFAULT_PRIORITY, &test_delegate));
85 85
86 if (from_user) { 86 if (from_user) {
87 content::ResourceRequestInfo::AllocateForTesting( 87 content::ResourceRequestInfo::AllocateForTesting(
88 request.get(), content::RESOURCE_TYPE_MAIN_FRAME, nullptr, -2, -2, -2, 88 request.get(), content::RESOURCE_TYPE_MAIN_FRAME, nullptr, -2, -2, -2,
89 true, false, true, true, false); 89 true, false, true, true, false);
90 } else { 90 } else {
91 request->SetUserData( 91 request->SetUserData(
92 data_use_measurement::DataUseUserData::kUserDataKey, 92 data_use_measurement::DataUseUserData::kUserDataKey,
93 new data_use_measurement::DataUseUserData( 93 new data_use_measurement::DataUseUserData(
94 data_use_measurement::DataUseUserData::SUGGESTIONS)); 94 data_use_measurement::DataUseUserData::SUGGESTIONS, true));
95 } 95 }
96 request->Start(); 96 request->Start();
97 base::RunLoop().RunUntilIdle(); 97 base::RunLoop().RunUntilIdle();
98 return request; 98 return request;
99 } 99 }
100 100
101 // A fake DataUseAggregator for testing that only counts how many times its 101 // A fake DataUseAggregator for testing that only counts how many times its
102 // respective methods have been called. 102 // respective methods have been called.
103 class FakeDataUseAggregator : public data_usage::DataUseAggregator { 103 class FakeDataUseAggregator : public data_usage::DataUseAggregator {
104 public: 104 public:
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 639
640 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite, 640 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite,
641 kBlockedFirstPartySite)); 641 kBlockedFirstPartySite));
642 642
643 cookie_settings_->SetCookieSetting(kBlockedFirstPartySite, 643 cookie_settings_->SetCookieSetting(kBlockedFirstPartySite,
644 CONTENT_SETTING_BLOCK); 644 CONTENT_SETTING_BLOCK);
645 // Privacy mode is disabled as kAllowedSite is still getting cookies 645 // Privacy mode is disabled as kAllowedSite is still getting cookies
646 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite, 646 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite,
647 kBlockedFirstPartySite)); 647 kBlockedFirstPartySite));
648 } 648 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698