| 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/string_number_conversions.h" | 6 #include "base/string_number_conversions.h" |
| 7 #include "base/time.h" | 7 #include "base/time.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 MessageLoop loop_; | 36 MessageLoop loop_; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 class SyncPromoTest : public PromoResourceServiceTest, | 39 class SyncPromoTest : public PromoResourceServiceTest, |
| 40 public content::NotificationObserver { | 40 public content::NotificationObserver { |
| 41 public: | 41 public: |
| 42 SyncPromoTest() : PromoResourceServiceTest(), notifications_allowed_(false) { | 42 SyncPromoTest() : PromoResourceServiceTest(), notifications_allowed_(false) { |
| 43 web_resource_service_->set_channel(chrome::VersionInfo::CHANNEL_DEV); | 43 web_resource_service_->set_channel(chrome::VersionInfo::CHANNEL_DEV); |
| 44 registrar_.Add(this, | 44 registrar_.Add(this, |
| 45 chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, | 45 chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, |
| 46 NotificationService::AllSources()); | 46 content::NotificationService::AllSources()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 virtual void Observe(int type, | 49 virtual void Observe(int type, |
| 50 const content::NotificationSource& source, | 50 const content::NotificationSource& source, |
| 51 const content::NotificationDetails& details) { | 51 const content::NotificationDetails& details) { |
| 52 // If we get any unexpected notifications we should fail. | 52 // If we get any unexpected notifications we should fail. |
| 53 EXPECT_TRUE(notifications_allowed_); | 53 EXPECT_TRUE(notifications_allowed_); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void allow_notifications(bool allowed) { notifications_allowed_ = allowed; } | 56 void allow_notifications(bool allowed) { notifications_allowed_ = allowed; } |
| (...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 7)); | 895 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 7)); |
| 896 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 15)); | 896 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 15)); |
| 897 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 8)); | 897 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 8)); |
| 898 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 11)); | 898 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 11)); |
| 899 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 12)); | 899 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 12)); |
| 900 | 900 |
| 901 // invalid | 901 // invalid |
| 902 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, -1)); | 902 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, -1)); |
| 903 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, INT_MAX)); | 903 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, INT_MAX)); |
| 904 } | 904 } |
| OLD | NEW |