| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 200 } |
| 201 | 201 |
| 202 double CheckScoreFromSettingsOnThread( | 202 double CheckScoreFromSettingsOnThread( |
| 203 content::BrowserThread::ID thread_id, | 203 content::BrowserThread::ID thread_id, |
| 204 HostContentSettingsMap* settings_map, | 204 HostContentSettingsMap* settings_map, |
| 205 const GURL& url) { | 205 const GURL& url) { |
| 206 double score = 0; | 206 double score = 0; |
| 207 base::RunLoop run_loop; | 207 base::RunLoop run_loop; |
| 208 content::BrowserThread::PostTaskAndReply( | 208 content::BrowserThread::PostTaskAndReply( |
| 209 thread_id, FROM_HERE, | 209 thread_id, FROM_HERE, |
| 210 base::Bind(&SiteEngagementServiceTest::CheckScoreFromSettings, | 210 base::BindOnce(&SiteEngagementServiceTest::CheckScoreFromSettings, |
| 211 base::Unretained(this), settings_map, url, &score), | 211 base::Unretained(this), settings_map, url, &score), |
| 212 run_loop.QuitClosure()); | 212 run_loop.QuitClosure()); |
| 213 run_loop.Run(); | 213 run_loop.Run(); |
| 214 return score; | 214 return score; |
| 215 } | 215 } |
| 216 | 216 |
| 217 protected: | 217 protected: |
| 218 void CheckScoreFromSettings(HostContentSettingsMap* settings_map, | 218 void CheckScoreFromSettings(HostContentSettingsMap* settings_map, |
| 219 const GURL& url, | 219 const GURL& url, |
| 220 double *score) { | 220 double *score) { |
| 221 *score = SiteEngagementService::GetScoreFromSettings(settings_map, url); | 221 *score = SiteEngagementService::GetScoreFromSettings(settings_map, url); |
| 222 } | 222 } |
| (...skipping 1611 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 |