OLD | NEW |
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 "base/bind_helpers.h" | 5 #include "base/bind_helpers.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/browser/budget_service/budget_manager.h" | 9 #include "chrome/browser/budget_service/budget_manager.h" |
10 #include "chrome/browser/budget_service/budget_manager_factory.h" | 10 #include "chrome/browser/budget_service/budget_manager_factory.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 void SetUpCommandLine(base::CommandLine* command_line) override { | 53 void SetUpCommandLine(base::CommandLine* command_line) override { |
54 // TODO(harkness): Remove switch once Budget API ships. (crbug.com/617971) | 54 // TODO(harkness): Remove switch once Budget API ships. (crbug.com/617971) |
55 command_line->AppendSwitch( | 55 command_line->AppendSwitch( |
56 switches::kEnableExperimentalWebPlatformFeatures); | 56 switches::kEnableExperimentalWebPlatformFeatures); |
57 InProcessBrowserTest::SetUpCommandLine(command_line); | 57 InProcessBrowserTest::SetUpCommandLine(command_line); |
58 } | 58 } |
59 | 59 |
60 void SetSiteEngagementScore(double score) { | 60 void SetSiteEngagementScore(double score) { |
61 SiteEngagementService* service = | 61 SiteEngagementService* service = |
62 SiteEngagementService::Get(browser()->profile()); | 62 SiteEngagementService::Get(browser()->profile()); |
63 service->ResetScoreForURL(https_server_->GetURL(kTestURL), score); | 63 service->ResetBaseScoreForURL(https_server_->GetURL(kTestURL), score); |
64 } | 64 } |
65 | 65 |
66 bool RunScript(const std::string& script, std::string* result) { | 66 bool RunScript(const std::string& script, std::string* result) { |
67 content::WebContents* web_contents = | 67 content::WebContents* web_contents = |
68 browser()->tab_strip_model()->GetActiveWebContents(); | 68 browser()->tab_strip_model()->GetActiveWebContents(); |
69 return content::ExecuteScriptAndExtractString(web_contents->GetMainFrame(), | 69 return content::ExecuteScriptAndExtractString(web_contents->GetMainFrame(), |
70 script, result); | 70 script, result); |
71 } | 71 } |
72 | 72 |
73 void LoadTestPage() { | 73 void LoadTestPage() { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 ConsumeReservation(); | 166 ConsumeReservation(); |
167 ASSERT_TRUE(success()); | 167 ASSERT_TRUE(success()); |
168 | 168 |
169 // One more consume should fail, because all reservations are consumed. | 169 // One more consume should fail, because all reservations are consumed. |
170 ConsumeReservation(); | 170 ConsumeReservation(); |
171 ASSERT_FALSE(success()); | 171 ASSERT_FALSE(success()); |
172 } | 172 } |
173 | 173 |
174 } // namespace | 174 } // namespace |
OLD | NEW |