| 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/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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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/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 web_resource_service_->set_use_utility_process_for_testing(false); |
| 32 } | 33 } |
| 33 | 34 |
| 34 protected: | 35 protected: |
| 35 TestingProfile profile_; | 36 TestingProfile profile_; |
| 36 ScopedTestingLocalState local_state_; | 37 ScopedTestingLocalState local_state_; |
| 37 scoped_refptr<PromoResourceService> web_resource_service_; | 38 scoped_refptr<PromoResourceService> web_resource_service_; |
| 38 MessageLoop loop_; | 39 MessageLoop loop_; |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 class NTPSignInPromoTest : public PromoResourceServiceTest, | 42 class NTPSignInPromoTest : public PromoResourceServiceTest, |
| (...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 7)); | 1140 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 7)); |
| 1140 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 15)); | 1141 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 15)); |
| 1141 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 8)); | 1142 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 8)); |
| 1142 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 11)); | 1143 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 11)); |
| 1143 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 12)); | 1144 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 12)); |
| 1144 | 1145 |
| 1145 // invalid | 1146 // invalid |
| 1146 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, -1)); | 1147 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, -1)); |
| 1147 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, INT_MAX)); | 1148 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, INT_MAX)); |
| 1148 } | 1149 } |
| OLD | NEW |