OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/time.h" | 6 #include "base/time.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/extensions/apps_promo.h" | 10 #include "chrome/browser/extensions/apps_promo.h" |
10 #include "chrome/browser/prefs/browser_prefs.h" | 11 #include "chrome/browser/prefs/browser_prefs.h" |
11 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
12 #include "chrome/browser/web_resource/promo_resource_service.h" | 13 #include "chrome/browser/web_resource/promo_resource_service.h" |
13 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
14 #include "chrome/test/base/testing_browser_process_test.h" | 15 #include "chrome/test/base/testing_browser_process.h" |
15 #include "chrome/test/base/testing_pref_service.h" | 16 #include "chrome/test/base/testing_pref_service.h" |
16 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 class PromoResourceServiceTest : public TestingBrowserProcessTest { | 20 class PromoResourceServiceTest : public testing::Test { |
20 public: | 21 public: |
21 PromoResourceServiceTest() | 22 PromoResourceServiceTest() |
22 : local_state_(testing_browser_process_.get()), | 23 : local_state_(static_cast<TestingBrowserProcess*>(g_browser_process)), |
23 web_resource_service_(new PromoResourceService(&profile_)) { | 24 web_resource_service_(new PromoResourceService(&profile_)) { |
24 } | 25 } |
25 | 26 |
26 protected: | 27 protected: |
27 TestingProfile profile_; | 28 TestingProfile profile_; |
28 ScopedTestingLocalState local_state_; | 29 ScopedTestingLocalState local_state_; |
29 scoped_refptr<PromoResourceService> web_resource_service_; | 30 scoped_refptr<PromoResourceService> web_resource_service_; |
30 }; | 31 }; |
31 | 32 |
32 // Verifies that custom dates read from a web resource server are written to | 33 // Verifies that custom dates read from a web resource server are written to |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 const chrome::VersionInfo::Channel stable = | 265 const chrome::VersionInfo::Channel stable = |
265 chrome::VersionInfo::CHANNEL_STABLE; | 266 chrome::VersionInfo::CHANNEL_STABLE; |
266 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 1)); | 267 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 1)); |
267 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 3)); | 268 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 3)); |
268 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 7)); | 269 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 7)); |
269 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 15)); | 270 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 15)); |
270 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 8)); | 271 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 8)); |
271 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 11)); | 272 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 11)); |
272 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 12)); | 273 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 12)); |
273 } | 274 } |
OLD | NEW |