| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/engagement/site_engagement_service.h" | 5 #include "chrome/browser/engagement/site_engagement_service.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 settings_map->SetContentSettingDefaultScope( | 550 settings_map->SetContentSettingDefaultScope( |
| 551 url1, GURL(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 551 url1, GURL(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
| 552 content_settings::ResourceIdentifier(), CONTENT_SETTING_ALLOW); | 552 content_settings::ResourceIdentifier(), CONTENT_SETTING_ALLOW); |
| 553 | 553 |
| 554 settings_map->SetContentSettingDefaultScope( | 554 settings_map->SetContentSettingDefaultScope( |
| 555 url2, GURL(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 555 url2, GURL(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
| 556 content_settings::ResourceIdentifier(), CONTENT_SETTING_BLOCK); | 556 content_settings::ResourceIdentifier(), CONTENT_SETTING_BLOCK); |
| 557 | 557 |
| 558 settings_map->SetContentSettingDefaultScope( | 558 settings_map->SetContentSettingDefaultScope( |
| 559 url3, GURL(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 559 url3, GURL(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
| 560 content_settings::ResourceIdentifier(), CONTENT_SETTING_ASK); | 560 content_settings::ResourceIdentifier(), CONTENT_SETTING_DEFAULT); |
| 561 | 561 |
| 562 EXPECT_EQ(5, service_->GetScore(url1)); | 562 EXPECT_EQ(5, service_->GetScore(url1)); |
| 563 EXPECT_EQ(0, service_->GetScore(url2)); | 563 EXPECT_EQ(0, service_->GetScore(url2)); |
| 564 EXPECT_EQ(0, service_->GetScore(url3)); | 564 EXPECT_EQ(0, service_->GetScore(url3)); |
| 565 | 565 |
| 566 service_->AddPoints(url1, 1.0); | 566 service_->AddPoints(url1, 1.0); |
| 567 service_->AddPoints(url2, 3.0); | 567 service_->AddPoints(url2, 3.0); |
| 568 EXPECT_EQ(6, service_->GetScore(url1)); | 568 EXPECT_EQ(6, service_->GetScore(url1)); |
| 569 EXPECT_EQ(3, service_->GetScore(url2)); | 569 EXPECT_EQ(3, service_->GetScore(url2)); |
| 570 | 570 |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1834 content_settings::ResourceIdentifier(), CONTENT_SETTING_BLOCK); | 1834 content_settings::ResourceIdentifier(), CONTENT_SETTING_BLOCK); |
| 1835 settings_map->SetContentSettingDefaultScope( | 1835 settings_map->SetContentSettingDefaultScope( |
| 1836 url4, GURL(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 1836 url4, GURL(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
| 1837 content_settings::ResourceIdentifier(), CONTENT_SETTING_BLOCK); | 1837 content_settings::ResourceIdentifier(), CONTENT_SETTING_BLOCK); |
| 1838 | 1838 |
| 1839 // Verify that the URLs with engagement, and with notifications permission | 1839 // Verify that the URLs with engagement, and with notifications permission |
| 1840 // boosted engagement total, are included. | 1840 // boosted engagement total, are included. |
| 1841 details = service_->GetAllDetails(); | 1841 details = service_->GetAllDetails(); |
| 1842 EXPECT_EQ(2u, details.size()); | 1842 EXPECT_EQ(2u, details.size()); |
| 1843 } | 1843 } |
| OLD | NEW |