| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 SiteEngagementScore::SetParamValuesForTesting(); | 51 SiteEngagementScore::SetParamValuesForTesting(); |
| 52 | 52 |
| 53 // Grant Notification permission for these tests. See the privacy | 53 // Grant Notification permission for these tests. See the privacy |
| 54 // requirement for this outlined in https://crbug.com/710809. | 54 // requirement for this outlined in https://crbug.com/710809. |
| 55 HostContentSettingsMapFactory::GetForProfile(browser()->profile()) | 55 HostContentSettingsMapFactory::GetForProfile(browser()->profile()) |
| 56 ->SetContentSettingDefaultScope(https_server_->base_url(), GURL(), | 56 ->SetContentSettingDefaultScope(https_server_->base_url(), GURL(), |
| 57 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 57 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
| 58 std::string(), CONTENT_SETTING_ALLOW); | 58 std::string(), CONTENT_SETTING_ALLOW); |
| 59 | 59 |
| 60 LoadTestPage(); | 60 LoadTestPage(); |
| 61 InProcessBrowserTest::SetUpOnMainThread(); | |
| 62 budget_manager_ = BudgetManagerFactory::GetForProfile(browser()->profile()); | 61 budget_manager_ = BudgetManagerFactory::GetForProfile(browser()->profile()); |
| 63 } | 62 } |
| 64 | 63 |
| 65 // InProcessBrowserTest: | 64 // InProcessBrowserTest: |
| 66 void SetUpCommandLine(base::CommandLine* command_line) override { | 65 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 67 // TODO(harkness): Remove switch once Budget API ships. (crbug.com/617971) | 66 // TODO(harkness): Remove switch once Budget API ships. (crbug.com/617971) |
| 68 command_line->AppendSwitch( | 67 command_line->AppendSwitch( |
| 69 switches::kEnableExperimentalWebPlatformFeatures); | 68 switches::kEnableExperimentalWebPlatformFeatures); |
| 70 InProcessBrowserTest::SetUpCommandLine(command_line); | 69 InProcessBrowserTest::SetUpCommandLine(command_line); |
| 71 } | 70 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 188 |
| 190 ConsumeReservation(); | 189 ConsumeReservation(); |
| 191 ASSERT_TRUE(success()); | 190 ASSERT_TRUE(success()); |
| 192 | 191 |
| 193 // One more consume should fail, because all reservations are consumed. | 192 // One more consume should fail, because all reservations are consumed. |
| 194 ConsumeReservation(); | 193 ConsumeReservation(); |
| 195 ASSERT_FALSE(success()); | 194 ASSERT_FALSE(success()); |
| 196 } | 195 } |
| 197 | 196 |
| 198 } // namespace | 197 } // namespace |
| OLD | NEW |