Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: chrome/browser/budget_service/budget_manager_unittest.cc

Issue 2735333002: Rename SiteEngagementService::ResetScoreForURL. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <stdint.h> 5 #include <stdint.h>
6 #include <string> 6 #include <string>
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/histogram_tester.h" 10 #include "base/test/histogram_tester.h"
(...skipping 20 matching lines...) Expand all
31 public: 31 public:
32 BudgetManagerTest() : origin_(url::Origin(GURL(kTestOrigin))) {} 32 BudgetManagerTest() : origin_(url::Origin(GURL(kTestOrigin))) {}
33 ~BudgetManagerTest() override {} 33 ~BudgetManagerTest() override {}
34 34
35 BudgetManager* GetManager() { 35 BudgetManager* GetManager() {
36 return BudgetManagerFactory::GetForProfile(&profile_); 36 return BudgetManagerFactory::GetForProfile(&profile_);
37 } 37 }
38 38
39 void SetSiteEngagementScore(double score) { 39 void SetSiteEngagementScore(double score) {
40 SiteEngagementService* service = SiteEngagementService::Get(&profile_); 40 SiteEngagementService* service = SiteEngagementService::Get(&profile_);
41 service->ResetScoreForURL(GURL(origin().Serialize()), score); 41 service->ResetBaseScoreForURL(GURL(origin().Serialize()), score);
42 } 42 }
43 43
44 Profile* profile() { return &profile_; } 44 Profile* profile() { return &profile_; }
45 const url::Origin origin() const { return origin_; } 45 const url::Origin origin() const { return origin_; }
46 void SetOrigin(const url::Origin& origin) { origin_ = origin; } 46 void SetOrigin(const url::Origin& origin) { origin_ = origin; }
47 47
48 void GetBudgetCallback(base::Closure run_loop_closure, 48 void GetBudgetCallback(base::Closure run_loop_closure,
49 blink::mojom::BudgetServiceErrorType error, 49 blink::mojom::BudgetServiceErrorType error,
50 std::vector<blink::mojom::BudgetStatePtr> budget) { 50 std::vector<blink::mojom::BudgetStatePtr> budget) {
51 // The BudgetDatabaseTest class tests all of the budget values returned. 51 // The BudgetDatabaseTest class tests all of the budget values returned.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 TEST_F(BudgetManagerTest, TestUniqueOrigin) { 177 TEST_F(BudgetManagerTest, TestUniqueOrigin) {
178 const blink::mojom::BudgetOperationType type = 178 const blink::mojom::BudgetOperationType type =
179 blink::mojom::BudgetOperationType::SILENT_PUSH; 179 blink::mojom::BudgetOperationType::SILENT_PUSH;
180 SetOrigin(url::Origin(GURL("file://example.com:443/etc/passwd"))); 180 SetOrigin(url::Origin(GURL("file://example.com:443/etc/passwd")));
181 181
182 // Methods on the BudgetManager should not be allowed for unique origins. 182 // Methods on the BudgetManager should not be allowed for unique origins.
183 ASSERT_FALSE(ReserveBudget(type)); 183 ASSERT_FALSE(ReserveBudget(type));
184 ASSERT_EQ(blink::mojom::BudgetServiceErrorType::NOT_SUPPORTED, error_); 184 ASSERT_EQ(blink::mojom::BudgetServiceErrorType::NOT_SUPPORTED, error_);
185 ASSERT_FALSE(ConsumeBudget(type)); 185 ASSERT_FALSE(ConsumeBudget(type));
186 } 186 }
OLDNEW
« no previous file with comments | « chrome/browser/budget_service/budget_manager_browsertest.cc ('k') | chrome/browser/engagement/important_sites_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698