| 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 <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 GURL("http://example.com"), net::DEFAULT_PRIORITY, &test_delegate)); | 83 GURL("http://example.com"), net::DEFAULT_PRIORITY, &test_delegate)); |
| 84 | 84 |
| 85 if (from_user) { | 85 if (from_user) { |
| 86 content::ResourceRequestInfo::AllocateForTesting( | 86 content::ResourceRequestInfo::AllocateForTesting( |
| 87 request.get(), content::RESOURCE_TYPE_MAIN_FRAME, nullptr, -2, -2, -2, | 87 request.get(), content::RESOURCE_TYPE_MAIN_FRAME, nullptr, -2, -2, -2, |
| 88 true, false, true, true, false); | 88 true, false, true, true, false); |
| 89 } else { | 89 } else { |
| 90 request->SetUserData( | 90 request->SetUserData( |
| 91 data_use_measurement::DataUseUserData::kUserDataKey, | 91 data_use_measurement::DataUseUserData::kUserDataKey, |
| 92 new data_use_measurement::DataUseUserData( | 92 new data_use_measurement::DataUseUserData( |
| 93 data_use_measurement::DataUseUserData::SUGGESTIONS)); | 93 data_use_measurement::DataUseUserData::SUGGESTIONS, true)); |
| 94 } | 94 } |
| 95 request->Start(); | 95 request->Start(); |
| 96 base::RunLoop().RunUntilIdle(); | 96 base::RunLoop().RunUntilIdle(); |
| 97 return request; | 97 return request; |
| 98 } | 98 } |
| 99 | 99 |
| 100 // A fake DataUseAggregator for testing that only counts how many times its | 100 // A fake DataUseAggregator for testing that only counts how many times its |
| 101 // respective methods have been called. | 101 // respective methods have been called. |
| 102 class FakeDataUseAggregator : public data_usage::DataUseAggregator { | 102 class FakeDataUseAggregator : public data_usage::DataUseAggregator { |
| 103 public: | 103 public: |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 | 623 |
| 624 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite, | 624 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite, |
| 625 kBlockedFirstPartySite)); | 625 kBlockedFirstPartySite)); |
| 626 | 626 |
| 627 cookie_settings_->SetCookieSetting(kBlockedFirstPartySite, | 627 cookie_settings_->SetCookieSetting(kBlockedFirstPartySite, |
| 628 CONTENT_SETTING_BLOCK); | 628 CONTENT_SETTING_BLOCK); |
| 629 // Privacy mode is disabled as kAllowedSite is still getting cookies | 629 // Privacy mode is disabled as kAllowedSite is still getting cookies |
| 630 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite, | 630 EXPECT_FALSE(network_delegate_->CanEnablePrivacyMode(kAllowedSite, |
| 631 kBlockedFirstPartySite)); | 631 kBlockedFirstPartySite)); |
| 632 } | 632 } |
| OLD | NEW |