OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 PushMessagingServiceImpl* push_service() const { return push_service_; } | 275 PushMessagingServiceImpl* push_service() const { return push_service_; } |
276 | 276 |
277 void SetSiteEngagementScore(const GURL& url, | 277 void SetSiteEngagementScore(const GURL& url, |
278 double score, | 278 double score, |
279 double expected_score) { | 279 double expected_score) { |
280 // There will be a bonus of 5.0 points for having notification permission | 280 // There will be a bonus of 5.0 points for having notification permission |
281 // granted, so we assert that the final score is as expected. | 281 // granted, so we assert that the final score is as expected. |
282 SiteEngagementService* service = | 282 SiteEngagementService* service = |
283 SiteEngagementService::Get(GetBrowser()->profile()); | 283 SiteEngagementService::Get(GetBrowser()->profile()); |
284 service->ResetScoreForURL(url, score); | 284 service->ResetBaseScoreForURL(url, score); |
285 EXPECT_EQ(expected_score, service->GetScore(url)); | 285 EXPECT_EQ(expected_score, service->GetScore(url)); |
286 } | 286 } |
287 | 287 |
288 protected: | 288 protected: |
289 virtual std::string GetTestURL() { return "/push_messaging/test.html"; } | 289 virtual std::string GetTestURL() { return "/push_messaging/test.html"; } |
290 | 290 |
291 virtual std::string GetNoManifestTestURL() { | 291 virtual std::string GetNoManifestTestURL() { |
292 return "/push_messaging/test_no_manifest.html"; | 292 return "/push_messaging/test_no_manifest.html"; |
293 } | 293 } |
294 | 294 |
(...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2245 push_service()->SetUnsubscribeCallbackForTesting(run_loop.QuitClosure()); | 2245 push_service()->SetUnsubscribeCallbackForTesting(run_loop.QuitClosure()); |
2246 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | 2246 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
2247 EXPECT_EQ("unsubscribe result: true", script_result); | 2247 EXPECT_EQ("unsubscribe result: true", script_result); |
2248 // Background mode is only guaranteed to have updated once the unsubscribe | 2248 // Background mode is only guaranteed to have updated once the unsubscribe |
2249 // callback for testing has been run (PushSubscription.unsubscribe() usually | 2249 // callback for testing has been run (PushSubscription.unsubscribe() usually |
2250 // resolves before that, in order to avoid blocking on network retries etc). | 2250 // resolves before that, in order to avoid blocking on network retries etc). |
2251 run_loop.Run(); | 2251 run_loop.Run(); |
2252 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); | 2252 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); |
2253 } | 2253 } |
2254 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS) | 2254 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS) |
OLD | NEW |