| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include <stdint.h> |
| 6 #include <string> |
| 7 |
| 8 #include "chrome/browser/push_messaging/background_budget_service.h" |
| 9 #include "chrome/test/base/testing_profile.h" |
| 10 #include "content/public/test/test_browser_thread_bundle.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 |
| 13 namespace { |
| 14 |
| 15 const char kTestOrigin[] = "https://example.com"; |
| 16 const char kTestData[] = "1111101111"; |
| 17 |
| 18 } // namespace |
| 19 |
| 20 class BackgroundBudgetServiceTest : public testing::Test { |
| 21 public: |
| 22 BackgroundBudgetServiceTest() {} |
| 23 ~BackgroundBudgetServiceTest() override {} |
| 24 |
| 25 TestingProfile* profile() { return &profile_; } |
| 26 |
| 27 private: |
| 28 content::TestBrowserThreadBundle thread_bundle_; |
| 29 TestingProfile profile_; |
| 30 }; |
| 31 |
| 32 TEST_F(BackgroundBudgetServiceTest, GetBudgetFailure) { |
| 33 const GURL origin(kTestOrigin); |
| 34 |
| 35 std::string budget_string = |
| 36 BackgroundBudgetService::GetBudget(profile(), origin); |
| 37 |
| 38 EXPECT_EQ(std::string(), budget_string); |
| 39 } |
| 40 |
| 41 TEST_F(BackgroundBudgetServiceTest, GetBudgetSuccess) { |
| 42 const GURL origin(kTestOrigin); |
| 43 |
| 44 BackgroundBudgetService::StoreBudget(profile(), origin, kTestData); |
| 45 |
| 46 std::string budget_string = |
| 47 BackgroundBudgetService::GetBudget(profile(), origin); |
| 48 |
| 49 EXPECT_EQ(kTestData, budget_string); |
| 50 } |
| OLD | NEW |