| 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 <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/test/simple_test_clock.h" | 9 #include "base/test/simple_test_clock.h" |
| 10 #include "chrome/browser/budget_service/background_budget_service.h" |
| 11 #include "chrome/browser/budget_service/background_budget_service_factory.h" |
| 10 #include "chrome/browser/engagement/site_engagement_service.h" | 12 #include "chrome/browser/engagement/site_engagement_service.h" |
| 11 #include "chrome/browser/push_messaging/background_budget_service.h" | |
| 12 #include "chrome/browser/push_messaging/background_budget_service_factory.h" | |
| 13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 14 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
| 15 #include "components/prefs/pref_service.h" | 15 #include "components/prefs/pref_service.h" |
| 16 #include "components/prefs/scoped_user_pref_update.h" | 16 #include "components/prefs/scoped_user_pref_update.h" |
| 17 #include "content/public/test/test_browser_thread_bundle.h" | 17 #include "content/public/test/test_browser_thread_bundle.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 const char kTestOrigin[] = "https://example.com"; | 22 const char kTestOrigin[] = "https://example.com"; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 double budget = service->GetBudget(origin); | 232 double budget = service->GetBudget(origin); |
| 233 service->StoreBudget(origin, budget); | 233 service->StoreBudget(origin, budget); |
| 234 EXPECT_NE(kTestBudget, budget); | 234 EXPECT_NE(kTestBudget, budget); |
| 235 | 235 |
| 236 // Now move time backwards a day and make sure that the current | 236 // Now move time backwards a day and make sure that the current |
| 237 // budget matches the budget of the most foward time. | 237 // budget matches the budget of the most foward time. |
| 238 clock->SetNow(starting_time - base::TimeDelta::FromDays(1)); | 238 clock->SetNow(starting_time - base::TimeDelta::FromDays(1)); |
| 239 double back_budget = service->GetBudget(origin); | 239 double back_budget = service->GetBudget(origin); |
| 240 EXPECT_NEAR(budget, back_budget, 0.01); | 240 EXPECT_NEAR(budget, back_budget, 0.01); |
| 241 } | 241 } |
| OLD | NEW |