Chromium Code Reviews| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 // A second reserve should fail because there is not enough budget. | 108 // A second reserve should fail because there is not enough budget. |
| 109 ASSERT_TRUE(RunScript("documentReserveBudget()", &script_result)); | 109 ASSERT_TRUE(RunScript("documentReserveBudget()", &script_result)); |
| 110 ASSERT_EQ("failed - not able to reserve budget", script_result); | 110 ASSERT_EQ("failed - not able to reserve budget", script_result); |
| 111 | 111 |
| 112 // Consume should succeed because there is an existing reservation. | 112 // Consume should succeed because there is an existing reservation. |
| 113 ConsumeReservation(); | 113 ConsumeReservation(); |
| 114 ASSERT_TRUE(success()); | 114 ASSERT_TRUE(success()); |
| 115 | 115 |
| 116 // Second consume should fail because the reservation is consumed. | 116 // Second consume should fail because the reservation is consumed. |
| 117 ConsumeReservation(); | 117 ConsumeReservation(); |
| 118 ASSERT_FALSE(success()); | 118 ASSERT_TRUE(success()); |
|
Peter Beverloo
2016/11/28 14:14:06
why?
harkness
2016/11/28 16:09:09
I was doing testing on another CL and somehow two
| |
| 119 } | 119 } |
| 120 | 120 |
| 121 IN_PROC_BROWSER_TEST_F(BudgetManagerBrowserTest, BudgetInWorker) { | 121 IN_PROC_BROWSER_TEST_F(BudgetManagerBrowserTest, BudgetInWorker) { |
| 122 std::string script_result; | 122 std::string script_result; |
| 123 | 123 |
| 124 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); | 124 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); |
| 125 ASSERT_EQ("ok - service worker registered", script_result); | 125 ASSERT_EQ("ok - service worker registered", script_result); |
| 126 | 126 |
| 127 LoadTestPage(); // Reload to become controlled. | 127 LoadTestPage(); // Reload to become controlled. |
| 128 | 128 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 155 | 155 |
| 156 ConsumeReservation(); | 156 ConsumeReservation(); |
| 157 ASSERT_TRUE(success()); | 157 ASSERT_TRUE(success()); |
| 158 | 158 |
| 159 // One more consume should fail, because all reservations are consumed. | 159 // One more consume should fail, because all reservations are consumed. |
| 160 ConsumeReservation(); | 160 ConsumeReservation(); |
| 161 ASSERT_FALSE(success()); | 161 ASSERT_FALSE(success()); |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace | 164 } // namespace |
| OLD | NEW |