| 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 18 matching lines...) Expand all Loading... |
| 29 web_resource_service_(new PromoResourceService(&profile_)) { | 29 web_resource_service_(new PromoResourceService(&profile_)) { |
| 30 } | 30 } |
| 31 | 31 |
| 32 protected: | 32 protected: |
| 33 TestingProfile profile_; | 33 TestingProfile profile_; |
| 34 ScopedTestingLocalState local_state_; | 34 ScopedTestingLocalState local_state_; |
| 35 scoped_refptr<PromoResourceService> web_resource_service_; | 35 scoped_refptr<PromoResourceService> web_resource_service_; |
| 36 MessageLoop loop_; | 36 MessageLoop loop_; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 class SyncPromoTest : public PromoResourceServiceTest, | 39 class NTPSignInPromoTest : public PromoResourceServiceTest, |
| 40 public content::NotificationObserver { | 40 public content::NotificationObserver { |
| 41 public: | 41 public: |
| 42 SyncPromoTest() : PromoResourceServiceTest(), notifications_received_(0) { | 42 NTPSignInPromoTest() : PromoResourceServiceTest(), |
| 43 notifications_received_(0) { |
| 43 web_resource_service_->set_channel(chrome::VersionInfo::CHANNEL_DEV); | 44 web_resource_service_->set_channel(chrome::VersionInfo::CHANNEL_DEV); |
| 44 registrar_.Add(this, | 45 registrar_.Add(this, |
| 45 chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, | 46 chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, |
| 46 content::NotificationService::AllSources()); | 47 content::NotificationService::AllSources()); |
| 47 } | 48 } |
| 48 | 49 |
| 49 virtual void Observe(int type, | 50 virtual void Observe(int type, |
| 50 const content::NotificationSource& source, | 51 const content::NotificationSource& source, |
| 51 const content::NotificationDetails& details) { | 52 const content::NotificationDetails& details) { |
| 52 EXPECT_EQ(type, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED); | 53 EXPECT_EQ(type, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED); |
| 53 // Remember how many notifications we've received. | 54 // Remember how many notifications we've received. |
| 54 ++notifications_received_; | 55 ++notifications_received_; |
| 55 } | 56 } |
| 56 | 57 |
| 57 void reset_notification_count() { | 58 void reset_notification_count() { |
| 58 notifications_received_ = 0; | 59 notifications_received_ = 0; |
| 59 } | 60 } |
| 60 | 61 |
| 61 int notifications_received() const { | 62 int notifications_received() const { |
| 62 return notifications_received_; | 63 return notifications_received_; |
| 63 } | 64 } |
| 64 | 65 |
| 65 protected: | 66 protected: |
| 66 void ClearSyncPromoPrefs() { | 67 void ClearNTPSignInPromoPrefs() { |
| 67 PrefService* prefs = profile_.GetPrefs(); | 68 PrefService* prefs = profile_.GetPrefs(); |
| 68 prefs->ClearPref(prefs::kNTPSyncPromoGroup); | 69 prefs->ClearPref(prefs::kNTPSignInPromoGroup); |
| 69 prefs->ClearPref(prefs::kNTPSyncPromoGroupMax); | 70 prefs->ClearPref(prefs::kNTPSignInPromoGroupMax); |
| 70 ASSERT_FALSE(prefs->HasPrefPath(prefs::kNTPSyncPromoGroup)); | 71 ASSERT_FALSE(prefs->HasPrefPath(prefs::kNTPSignInPromoGroup)); |
| 71 ASSERT_FALSE(prefs->HasPrefPath(prefs::kNTPSyncPromoGroupMax)); | 72 ASSERT_FALSE(prefs->HasPrefPath(prefs::kNTPSignInPromoGroupMax)); |
| 72 } | 73 } |
| 73 | 74 |
| 74 void InvalidTestCase(const std::string& question) { | 75 void InvalidTestCase(const std::string& question) { |
| 75 PrefService* prefs = profile_.GetPrefs(); | 76 PrefService* prefs = profile_.GetPrefs(); |
| 76 ASSERT_TRUE(prefs != NULL); | 77 ASSERT_TRUE(prefs != NULL); |
| 77 prefs->SetInteger(prefs::kNTPSyncPromoGroup, 50); | 78 prefs->SetInteger(prefs::kNTPSignInPromoGroup, 50); |
| 78 prefs->SetInteger(prefs::kNTPSyncPromoGroupMax, 75); | 79 prefs->SetInteger(prefs::kNTPSignInPromoGroupMax, 75); |
| 79 UnpackSyncPromo(question); | 80 UnpackNTPSignInPromo(question); |
| 80 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSyncPromoGroup)); | 81 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSignInPromoGroup)); |
| 81 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSyncPromoGroupMax)); | 82 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSignInPromoGroupMax)); |
| 82 } | 83 } |
| 83 | 84 |
| 84 void SetupSyncPromoCase(int build, int max_group) { | 85 void SetupNTPSignInPromoCase(int build, int max_group) { |
| 85 std::string question = base::IntToString(build) + ":" + | 86 std::string question = base::IntToString(build) + ":" + |
| 86 base::IntToString(max_group); | 87 base::IntToString(max_group); |
| 87 UnpackSyncPromo(question); | 88 UnpackNTPSignInPromo(question); |
| 88 } | 89 } |
| 89 | 90 |
| 90 void UnpackSyncPromo(const std::string& question) { | 91 void UnpackNTPSignInPromo(const std::string& question) { |
| 91 std::string json_header = | 92 std::string json_header = |
| 92 "{ " | 93 "{ " |
| 93 " \"topic\": {" | 94 " \"topic\": {" |
| 94 " \"answers\": [" | 95 " \"answers\": [" |
| 95 " {" | 96 " {" |
| 96 " \"name\": \"sync_promo\"," | 97 " \"name\": \"sign_in_promo\"," |
| 97 " \"question\": \""; | 98 " \"question\": \""; |
| 98 | 99 |
| 99 std::string json_footer = "\"" | 100 std::string json_footer = "\"" |
| 100 " }" | 101 " }" |
| 101 " ]" | 102 " ]" |
| 102 " }" | 103 " }" |
| 103 "}"; | 104 "}"; |
| 104 | 105 |
| 105 scoped_ptr<DictionaryValue> test_json(static_cast<DictionaryValue*>( | 106 scoped_ptr<DictionaryValue> test_json(static_cast<DictionaryValue*>( |
| 106 base::JSONReader::Read(json_header + question + json_footer, false))); | 107 base::JSONReader::Read(json_header + question + json_footer, false))); |
| 107 web_resource_service_->UnpackSyncPromoSignal(*(test_json.get())); | 108 web_resource_service_->UnpackNTPSignInPromoSignal(*(test_json.get())); |
| 108 } | 109 } |
| 109 | 110 |
| 110 private: | 111 private: |
| 111 int notifications_received_; | 112 int notifications_received_; |
| 112 content::NotificationRegistrar registrar_; | 113 content::NotificationRegistrar registrar_; |
| 113 }; | 114 }; |
| 114 | 115 |
| 115 // Verifies that custom dates read from a web resource server are written to | 116 // Verifies that custom dates read from a web resource server are written to |
| 116 // the preferences file. | 117 // the preferences file. |
| 117 TEST_F(PromoResourceServiceTest, UnpackLogoSignal) { | 118 TEST_F(PromoResourceServiceTest, UnpackLogoSignal) { |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 EXPECT_EQ(GURL("http://link.com"), actual_data.link); | 743 EXPECT_EQ(GURL("http://link.com"), actual_data.link); |
| 743 EXPECT_EQ("No thanks, hide this.", actual_data.expire); | 744 EXPECT_EQ("No thanks, hide this.", actual_data.expire); |
| 744 EXPECT_EQ(AppsPromo::USERS_NEW, actual_data.user_group); | 745 EXPECT_EQ(AppsPromo::USERS_NEW, actual_data.user_group); |
| 745 | 746 |
| 746 // Logos should be the default values because HTTP URLs are not valid. | 747 // Logos should be the default values because HTTP URLs are not valid. |
| 747 EXPECT_EQ(GURL("chrome://theme/IDR_WEBSTORE_ICON"), actual_data.logo); | 748 EXPECT_EQ(GURL("chrome://theme/IDR_WEBSTORE_ICON"), actual_data.logo); |
| 748 EXPECT_EQ(GURL(""), AppsPromo::GetSourcePromoLogoURL()); | 749 EXPECT_EQ(GURL(""), AppsPromo::GetSourcePromoLogoURL()); |
| 749 } | 750 } |
| 750 | 751 |
| 751 // Don't run sync promo unpacking tests on ChromeOS as on that plaform | 752 // Don't run sync promo unpacking tests on ChromeOS as on that plaform |
| 752 // PromoResourceService::UnpackSyncPromoSignal() basically just no-ops. | 753 // PromoResourceService::UnpackNTPSignInPromoSignal() basically just no-ops. |
| 753 #if !defined(OS_CHROMEOS) | 754 #if !defined(OS_CHROMEOS) |
| 754 TEST_F(SyncPromoTest, UnpackSyncPromoSignal) { | 755 TEST_F(NTPSignInPromoTest, UnpackNTPSignInPromoSignal) { |
| 755 PrefService* prefs = profile_.GetPrefs(); | 756 PrefService* prefs = profile_.GetPrefs(); |
| 756 ASSERT_TRUE(prefs != NULL); | 757 ASSERT_TRUE(prefs != NULL); |
| 757 | 758 |
| 758 // Test on by default (currently should be false). | 759 // Test on by default (currently should be false). |
| 759 EXPECT_FALSE(PromoResourceService::CanShowSyncPromo(&profile_)); | 760 EXPECT_FALSE(PromoResourceService::CanShowNTPSignInPromo(&profile_)); |
| 760 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSyncPromoGroup)); | 761 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSignInPromoGroup)); |
| 761 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSyncPromoGroupMax)); | 762 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSignInPromoGroupMax)); |
| 762 | 763 |
| 763 // Non-targeted build. | 764 // Non-targeted build. |
| 764 ClearSyncPromoPrefs(); | 765 ClearNTPSignInPromoPrefs(); |
| 765 SetupSyncPromoCase(2, 50); | 766 SetupNTPSignInPromoCase(2, 50); |
| 766 EXPECT_FALSE(PromoResourceService::CanShowSyncPromo(&profile_)); | 767 EXPECT_FALSE(PromoResourceService::CanShowNTPSignInPromo(&profile_)); |
| 767 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSyncPromoGroup)); | 768 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSignInPromoGroup)); |
| 768 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSyncPromoGroupMax)); | 769 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSignInPromoGroupMax)); |
| 769 | 770 |
| 770 // Targeted build, doesn't create bucket and doesn't show promo because | 771 // Targeted build, doesn't create bucket and doesn't show promo because |
| 771 // groupMax < group. | 772 // groupMax < group. |
| 772 ClearSyncPromoPrefs(); | 773 ClearNTPSignInPromoPrefs(); |
| 773 SetupSyncPromoCase(1, 0); | 774 SetupNTPSignInPromoCase(1, 0); |
| 774 EXPECT_FALSE(PromoResourceService::CanShowSyncPromo(&profile_)); | 775 EXPECT_FALSE(PromoResourceService::CanShowNTPSignInPromo(&profile_)); |
| 775 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSyncPromoGroupMax), 0); | 776 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSignInPromoGroupMax), 0); |
| 776 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSyncPromoGroup)); | 777 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSignInPromoGroup)); |
| 777 | 778 |
| 778 // Targeted build, max_group = 50, ensure group pref created and within the | 779 // Targeted build, max_group = 50, ensure group pref created and within the |
| 779 // group bounds. | 780 // group bounds. |
| 780 ClearSyncPromoPrefs(); | 781 ClearNTPSignInPromoPrefs(); |
| 781 SetupSyncPromoCase(1, 50); | 782 SetupNTPSignInPromoCase(1, 50); |
| 782 PromoResourceService::CanShowSyncPromo(&profile_); | 783 PromoResourceService::CanShowNTPSignInPromo(&profile_); |
| 783 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSyncPromoGroupMax), 50); | 784 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSignInPromoGroupMax), 50); |
| 784 EXPECT_TRUE(prefs->HasPrefPath(prefs::kNTPSyncPromoGroup)); | 785 EXPECT_TRUE(prefs->HasPrefPath(prefs::kNTPSignInPromoGroup)); |
| 785 EXPECT_GT(prefs->GetInteger(prefs::kNTPSyncPromoGroup), 0); | 786 EXPECT_GT(prefs->GetInteger(prefs::kNTPSignInPromoGroup), 0); |
| 786 EXPECT_LE(prefs->GetInteger(prefs::kNTPSyncPromoGroup), 100); | 787 EXPECT_LE(prefs->GetInteger(prefs::kNTPSignInPromoGroup), 100); |
| 787 | 788 |
| 788 // Set user group = 50, now shows promo. | 789 // Set user group = 50, now shows promo. |
| 789 prefs->SetInteger(prefs::kNTPSyncPromoGroup, 50); | 790 prefs->SetInteger(prefs::kNTPSignInPromoGroup, 50); |
| 790 EXPECT_TRUE(PromoResourceService::CanShowSyncPromo(&profile_)); | 791 EXPECT_TRUE(PromoResourceService::CanShowNTPSignInPromo(&profile_)); |
| 791 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSyncPromoGroup), 50); | 792 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSignInPromoGroup), 50); |
| 792 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSyncPromoGroupMax), 50); | 793 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSignInPromoGroupMax), 50); |
| 793 | 794 |
| 794 // Bump user group, ensure that we should not show promo. | 795 // Bump user group, ensure that we should not show promo. |
| 795 prefs->SetInteger(prefs::kNTPSyncPromoGroup, 51); | 796 prefs->SetInteger(prefs::kNTPSignInPromoGroup, 51); |
| 796 EXPECT_FALSE(PromoResourceService::CanShowSyncPromo(&profile_)); | 797 EXPECT_FALSE(PromoResourceService::CanShowNTPSignInPromo(&profile_)); |
| 797 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSyncPromoGroup), 51); | 798 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSignInPromoGroup), 51); |
| 798 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSyncPromoGroupMax), 50); | 799 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSignInPromoGroupMax), 50); |
| 799 | 800 |
| 800 // If the max group gets bumped to the user's group (or above), it should | 801 // If the max group gets bumped to the user's group (or above), it should |
| 801 // show. | 802 // show. |
| 802 prefs->SetInteger(prefs::kNTPSyncPromoGroupMax, 51); | 803 prefs->SetInteger(prefs::kNTPSignInPromoGroupMax, 51); |
| 803 EXPECT_TRUE(PromoResourceService::CanShowSyncPromo(&profile_)); | 804 EXPECT_TRUE(PromoResourceService::CanShowNTPSignInPromo(&profile_)); |
| 804 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSyncPromoGroup), 51); | 805 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSignInPromoGroup), 51); |
| 805 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSyncPromoGroupMax), 51); | 806 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSignInPromoGroupMax), 51); |
| 806 | 807 |
| 807 // Reduce max group. | 808 // Reduce max group. |
| 808 prefs->SetInteger(prefs::kNTPSyncPromoGroupMax, 49); | 809 prefs->SetInteger(prefs::kNTPSignInPromoGroupMax, 49); |
| 809 EXPECT_FALSE(PromoResourceService::CanShowSyncPromo(&profile_)); | 810 EXPECT_FALSE(PromoResourceService::CanShowNTPSignInPromo(&profile_)); |
| 810 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSyncPromoGroup), 51); | 811 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSignInPromoGroup), 51); |
| 811 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSyncPromoGroupMax), 49); | 812 EXPECT_EQ(prefs->GetInteger(prefs::kNTPSignInPromoGroupMax), 49); |
| 812 | 813 |
| 813 // Ignore non-targeted builds. | 814 // Ignore non-targeted builds. |
| 814 prefs->SetInteger(prefs::kNTPSyncPromoGroup, 50); | 815 prefs->SetInteger(prefs::kNTPSignInPromoGroup, 50); |
| 815 prefs->SetInteger(prefs::kNTPSyncPromoGroupMax, 75); | 816 prefs->SetInteger(prefs::kNTPSignInPromoGroupMax, 75); |
| 816 EXPECT_TRUE(PromoResourceService::CanShowSyncPromo(&profile_)); | 817 EXPECT_TRUE(PromoResourceService::CanShowNTPSignInPromo(&profile_)); |
| 817 SetupSyncPromoCase(2, 25); | 818 SetupNTPSignInPromoCase(2, 25); |
| 818 // Make sure the prefs are deleted. | 819 // Make sure the prefs are deleted. |
| 819 EXPECT_FALSE(PromoResourceService::CanShowSyncPromo(&profile_)); | 820 EXPECT_FALSE(PromoResourceService::CanShowNTPSignInPromo(&profile_)); |
| 820 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSyncPromoGroup)); | 821 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSignInPromoGroup)); |
| 821 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSyncPromoGroupMax)); | 822 EXPECT_FALSE(prefs->HasPrefPath(prefs::kNTPSignInPromoGroupMax)); |
| 822 } | 823 } |
| 823 | 824 |
| 824 // Throw random stuff at UnpackSyncPromoSignal and make sure no segfaults or | 825 // Throw random stuff at UnpackNTPSignInPromoSignal and make sure no segfaults |
| 825 // other issues and that the prefs were cleared. | 826 // or other issues and that the prefs were cleared. |
| 826 TEST_F(SyncPromoTest, UnpackSyncPromoSignalInvalid) { | 827 TEST_F(NTPSignInPromoTest, UnpackNTPSignInPromoSignalInvalid) { |
| 827 // Empty. | 828 // Empty. |
| 828 InvalidTestCase(""); | 829 InvalidTestCase(""); |
| 829 | 830 |
| 830 // Negative numbers. | 831 // Negative numbers. |
| 831 InvalidTestCase("-5:-6"); | 832 InvalidTestCase("-5:-6"); |
| 832 | 833 |
| 833 // An extra field. | 834 // An extra field. |
| 834 InvalidTestCase("1:0:1"); | 835 InvalidTestCase("1:0:1"); |
| 835 | 836 |
| 836 // A ton of separators. | 837 // A ton of separators. |
| 837 InvalidTestCase("::::::"); | 838 InvalidTestCase("::::::"); |
| 838 | 839 |
| 839 // Really big numbers. | 840 // Really big numbers. |
| 840 InvalidTestCase("68719476737:68719476737"); | 841 InvalidTestCase("68719476737:68719476737"); |
| 841 | 842 |
| 842 // UTF-8 chars. | 843 // UTF-8 chars. |
| 843 InvalidTestCase("だからって馬鹿に:してるの?怒る友人"); | 844 InvalidTestCase("だからって馬鹿に:してるの?怒る友人"); |
| 844 } | 845 } |
| 845 | 846 |
| 846 TEST_F(SyncPromoTest, UnpackSyncPromoSignalNotify) { | 847 TEST_F(NTPSignInPromoTest, UnpackNTPSignInPromoSignalNotify) { |
| 847 // Clear prefs and ensure we're not triggering notifications every time we | 848 // Clear prefs and ensure we're not triggering notifications every time we |
| 848 // receive not-targeted or valid data (only when we need to turn off the | 849 // receive not-targeted or valid data (only when we need to turn off the |
| 849 // promo). | 850 // promo). |
| 850 ClearSyncPromoPrefs(); | 851 ClearNTPSignInPromoPrefs(); |
| 851 reset_notification_count(); | 852 reset_notification_count(); |
| 852 | 853 |
| 853 // Non-targeted build. | 854 // Non-targeted build. |
| 854 SetupSyncPromoCase(2, 50); | 855 SetupNTPSignInPromoCase(2, 50); |
| 855 | 856 |
| 856 // Targeted, but under any possible max group. | 857 // Targeted, but under any possible max group. |
| 857 SetupSyncPromoCase(1, 0); | 858 SetupNTPSignInPromoCase(1, 0); |
| 858 | 859 |
| 859 // Targeted for sure, but shouldn't send notification. | 860 // Targeted for sure, but shouldn't send notification. |
| 860 SetupSyncPromoCase(1, 100); | 861 SetupNTPSignInPromoCase(1, 100); |
| 861 | 862 |
| 862 // Expect this didn't trigger any notifications. | 863 // Expect this didn't trigger any notifications. |
| 863 EXPECT_EQ(notifications_received(), 0); | 864 EXPECT_EQ(notifications_received(), 0); |
| 864 | 865 |
| 865 // Expect notifications when the promo is disabled, as this is expected | 866 // Expect notifications when the promo is disabled, as this is expected |
| 866 // behavior. | 867 // behavior. |
| 867 SetupSyncPromoCase(2, 0); | 868 SetupNTPSignInPromoCase(2, 0); |
| 868 EXPECT_EQ(notifications_received(), 1); | 869 EXPECT_EQ(notifications_received(), 1); |
| 869 } | 870 } |
| 870 #endif // !defined(OS_CHROMEOS) | 871 #endif // !defined(OS_CHROMEOS) |
| 871 | 872 |
| 872 TEST_F(PromoResourceServiceTest, IsBuildTargetedTest) { | 873 TEST_F(PromoResourceServiceTest, IsBuildTargetedTest) { |
| 873 // canary | 874 // canary |
| 874 const chrome::VersionInfo::Channel canary = | 875 const chrome::VersionInfo::Channel canary = |
| 875 chrome::VersionInfo::CHANNEL_CANARY; | 876 chrome::VersionInfo::CHANNEL_CANARY; |
| 876 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(canary, 1)); | 877 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(canary, 1)); |
| 877 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(canary, 3)); | 878 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(canary, 3)); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 908 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 7)); | 909 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 7)); |
| 909 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 15)); | 910 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 15)); |
| 910 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 8)); | 911 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 8)); |
| 911 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 11)); | 912 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, 11)); |
| 912 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 12)); | 913 EXPECT_TRUE(PromoResourceService::IsBuildTargeted(stable, 12)); |
| 913 | 914 |
| 914 // invalid | 915 // invalid |
| 915 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, -1)); | 916 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, -1)); |
| 916 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, INT_MAX)); | 917 EXPECT_FALSE(PromoResourceService::IsBuildTargeted(stable, INT_MAX)); |
| 917 } | 918 } |
| OLD | NEW |