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 "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 "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 // respective methods have been called. | 98 // respective methods have been called. |
99 class FakeDataUseAggregator : public data_usage::DataUseAggregator { | 99 class FakeDataUseAggregator : public data_usage::DataUseAggregator { |
100 public: | 100 public: |
101 FakeDataUseAggregator() | 101 FakeDataUseAggregator() |
102 : on_the_record_tx_bytes_(0), | 102 : on_the_record_tx_bytes_(0), |
103 on_the_record_rx_bytes_(0), | 103 on_the_record_rx_bytes_(0), |
104 off_the_record_tx_bytes_(0), | 104 off_the_record_tx_bytes_(0), |
105 off_the_record_rx_bytes_(0) {} | 105 off_the_record_rx_bytes_(0) {} |
106 ~FakeDataUseAggregator() override {} | 106 ~FakeDataUseAggregator() override {} |
107 | 107 |
108 void ReportDataUse(const net::URLRequest& request, | 108 void ReportDataUse(int64_t tx_bytes, |
tbansal1
2015/10/26 22:24:29
Why not keep the request object? Makes it easier i
sclittle
2015/10/26 23:56:01
You're right, but the request might no longer exis
| |
109 int32_t tab_id, | 109 int64_t rx_bytes, |
110 int64_t tx_bytes, | 110 const GURL& url, |
111 int64_t rx_bytes) override { | 111 const base::Time& request_time, |
112 const GURL& first_party_for_cookies, | |
113 int32_t tab_id) override { | |
112 on_the_record_tx_bytes_ += tx_bytes; | 114 on_the_record_tx_bytes_ += tx_bytes; |
113 on_the_record_rx_bytes_ += rx_bytes; | 115 on_the_record_rx_bytes_ += rx_bytes; |
114 } | 116 } |
115 | 117 |
116 void ReportOffTheRecordDataUse(int64_t tx_bytes, int64_t rx_bytes) override { | 118 void ReportOffTheRecordDataUse(int64_t tx_bytes, int64_t rx_bytes) override { |
117 off_the_record_tx_bytes_ += tx_bytes; | 119 off_the_record_tx_bytes_ += tx_bytes; |
118 off_the_record_rx_bytes_ += rx_bytes; | 120 off_the_record_rx_bytes_ += rx_bytes; |
119 } | 121 } |
120 | 122 |
121 int64_t on_the_record_tx_bytes() const { return on_the_record_tx_bytes_; } | 123 int64_t on_the_record_tx_bytes() const { return on_the_record_tx_bytes_; } |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
530 kBlockedFirstPartySite)); | 532 kBlockedFirstPartySite)); |
531 | 533 |
532 cookie_settings_->SetCookieSetting( | 534 cookie_settings_->SetCookieSetting( |
533 ContentSettingsPattern::FromURL(kBlockedFirstPartySite), | 535 ContentSettingsPattern::FromURL(kBlockedFirstPartySite), |
534 ContentSettingsPattern::Wildcard(), | 536 ContentSettingsPattern::Wildcard(), |
535 CONTENT_SETTING_BLOCK); | 537 CONTENT_SETTING_BLOCK); |
536 // Privacy mode is disabled as kAllowedSite is still getting cookies | 538 // Privacy mode is disabled as kAllowedSite is still getting cookies |
537 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite, | 539 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite, |
538 kBlockedFirstPartySite)); | 540 kBlockedFirstPartySite)); |
539 } | 541 } |
OLD | NEW |