| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/json/json_reader.h" | 5 #include "base/json/json_reader.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/extensions/apps_promo.h" | 12 #include "chrome/browser/extensions/apps_promo.h" |
| 13 #include "chrome/browser/prefs/browser_prefs.h" | 13 #include "chrome/browser/prefs/browser_prefs.h" |
| 14 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
| 15 #include "chrome/browser/web_resource/notification_promo.h" | 15 #include "chrome/browser/web_resource/notification_promo.h" |
| 16 #include "chrome/browser/web_resource/promo_resource_service.h" | 16 #include "chrome/browser/web_resource/promo_resource_service.h" |
| 17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
| 18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 19 #include "chrome/test/base/testing_browser_process.h" | 19 #include "chrome/test/base/testing_browser_process.h" |
| 20 #include "chrome/test/base/testing_pref_service.h" | 20 #include "chrome/test/base/testing_pref_service.h" |
| 21 #include "chrome/test/base/testing_profile.h" | 21 #include "chrome/test/base/testing_profile.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 23 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
| 24 #include "content/test/test_url_fetcher_factory.h" | 24 #include "content/public/test/test_url_fetcher_factory.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 26 |
| 27 class PromoResourceServiceTest : public testing::Test { | 27 class PromoResourceServiceTest : public testing::Test { |
| 28 public: | 28 public: |
| 29 PromoResourceServiceTest() | 29 PromoResourceServiceTest() |
| 30 : local_state_(static_cast<TestingBrowserProcess*>(g_browser_process)), | 30 : local_state_(static_cast<TestingBrowserProcess*>(g_browser_process)), |
| 31 web_resource_service_(new PromoResourceService(&profile_)) { | 31 web_resource_service_(new PromoResourceService(&profile_)) { |
| 32 } | 32 } |
| 33 | 33 |
| 34 protected: | 34 protected: |
| (...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 7)); | 1055 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 7)); |
| 1056 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 15)); | 1056 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 15)); |
| 1057 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 8)); | 1057 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 8)); |
| 1058 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 11)); | 1058 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 11)); |
| 1059 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 12)); | 1059 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 12)); |
| 1060 | 1060 |
| 1061 // invalid | 1061 // invalid |
| 1062 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, -1)); | 1062 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, -1)); |
| 1063 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, INT_MAX)); | 1063 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, INT_MAX)); |
| 1064 } | 1064 } |
| OLD | NEW |