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/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 7 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
8 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 8 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
9 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 9 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
10 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 10 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 : public ConfigurationPolicyPrefStoreTestBase< | 144 : public ConfigurationPolicyPrefStoreTestBase< |
145 testing::TestWithParam<TypeAndName> > { | 145 testing::TestWithParam<TypeAndName> > { |
146 }; | 146 }; |
147 | 147 |
148 TEST_P(ConfigurationPolicyPrefStoreBooleanTest, GetDefault) { | 148 TEST_P(ConfigurationPolicyPrefStoreBooleanTest, GetDefault) { |
149 EXPECT_EQ(PrefStore::READ_NO_VALUE, | 149 EXPECT_EQ(PrefStore::READ_NO_VALUE, |
150 store_->GetValue(GetParam().pref_name(), NULL)); | 150 store_->GetValue(GetParam().pref_name(), NULL)); |
151 } | 151 } |
152 | 152 |
153 TEST_P(ConfigurationPolicyPrefStoreBooleanTest, SetValue) { | 153 TEST_P(ConfigurationPolicyPrefStoreBooleanTest, SetValue) { |
154 provider_.AddPolicy(GetParam().type(), Value::CreateBooleanValue(false)); | 154 provider_.AddPolicy(GetParam().type(), base::FalseValue()); |
155 store_->OnUpdatePolicy(); | 155 store_->OnUpdatePolicy(); |
156 const Value* value = NULL; | 156 const Value* value = NULL; |
157 EXPECT_EQ(PrefStore::READ_OK, | 157 EXPECT_EQ(PrefStore::READ_OK, |
158 store_->GetValue(GetParam().pref_name(), &value)); | 158 store_->GetValue(GetParam().pref_name(), &value)); |
159 ASSERT_TRUE(value); | 159 ASSERT_TRUE(value); |
160 bool boolean_value = true; | 160 bool boolean_value = true; |
161 bool result = value->GetAsBoolean(&boolean_value); | 161 bool result = value->GetAsBoolean(&boolean_value); |
162 ASSERT_TRUE(result); | 162 ASSERT_TRUE(result); |
163 EXPECT_FALSE(boolean_value); | 163 EXPECT_FALSE(boolean_value); |
164 | 164 |
165 provider_.AddPolicy(GetParam().type(), Value::CreateBooleanValue(true)); | 165 provider_.AddPolicy(GetParam().type(), base::TrueValue()); |
166 store_->OnUpdatePolicy(); | 166 store_->OnUpdatePolicy(); |
167 value = NULL; | 167 value = NULL; |
168 EXPECT_EQ(PrefStore::READ_OK, | 168 EXPECT_EQ(PrefStore::READ_OK, |
169 store_->GetValue(GetParam().pref_name(), &value)); | 169 store_->GetValue(GetParam().pref_name(), &value)); |
170 boolean_value = false; | 170 boolean_value = false; |
171 result = value->GetAsBoolean(&boolean_value); | 171 result = value->GetAsBoolean(&boolean_value); |
172 ASSERT_TRUE(result); | 172 ASSERT_TRUE(result); |
173 EXPECT_TRUE(boolean_value); | 173 EXPECT_TRUE(boolean_value); |
174 } | 174 } |
175 | 175 |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 } | 511 } |
512 | 512 |
513 class ConfigurationPolicyPrefStoreDefaultSearchTest : public testing::Test { | 513 class ConfigurationPolicyPrefStoreDefaultSearchTest : public testing::Test { |
514 }; | 514 }; |
515 | 515 |
516 // Checks that if the policy for default search is valid, i.e. there's a | 516 // Checks that if the policy for default search is valid, i.e. there's a |
517 // search URL, that all the elements have been given proper defaults. | 517 // search URL, that all the elements have been given proper defaults. |
518 TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, MinimallyDefined) { | 518 TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, MinimallyDefined) { |
519 const char* const search_url = "http://test.com/search?t={searchTerms}"; | 519 const char* const search_url = "http://test.com/search?t={searchTerms}"; |
520 MockConfigurationPolicyProvider provider; | 520 MockConfigurationPolicyProvider provider; |
521 provider.AddPolicy(kPolicyDefaultSearchProviderEnabled, | 521 provider.AddPolicy(kPolicyDefaultSearchProviderEnabled, base::TrueValue()); |
522 Value::CreateBooleanValue(true)); | |
523 provider.AddPolicy(kPolicyDefaultSearchProviderSearchURL, | 522 provider.AddPolicy(kPolicyDefaultSearchProviderSearchURL, |
524 Value::CreateStringValue(search_url)); | 523 Value::CreateStringValue(search_url)); |
525 | 524 |
526 scoped_refptr<ConfigurationPolicyPrefStore> store( | 525 scoped_refptr<ConfigurationPolicyPrefStore> store( |
527 new ConfigurationPolicyPrefStore(&provider)); | 526 new ConfigurationPolicyPrefStore(&provider)); |
528 | 527 |
529 const Value* value = NULL; | 528 const Value* value = NULL; |
530 EXPECT_EQ(PrefStore::READ_OK, | 529 EXPECT_EQ(PrefStore::READ_OK, |
531 store->GetValue(prefs::kDefaultSearchProviderSearchURL, &value)); | 530 store->GetValue(prefs::kDefaultSearchProviderSearchURL, &value)); |
532 EXPECT_TRUE(StringValue(search_url).Equals(value)); | 531 EXPECT_TRUE(StringValue(search_url).Equals(value)); |
(...skipping 28 matching lines...) Expand all Loading... |
561 TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, FullyDefined) { | 560 TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, FullyDefined) { |
562 const char* const search_url = "http://test.com/search?t={searchTerms}"; | 561 const char* const search_url = "http://test.com/search?t={searchTerms}"; |
563 const char* const suggest_url = "http://test.com/sugg?={searchTerms}"; | 562 const char* const suggest_url = "http://test.com/sugg?={searchTerms}"; |
564 const char* const icon_url = "http://test.com/icon.jpg"; | 563 const char* const icon_url = "http://test.com/icon.jpg"; |
565 const char* const name = "MyName"; | 564 const char* const name = "MyName"; |
566 const char* const keyword = "MyKeyword"; | 565 const char* const keyword = "MyKeyword"; |
567 ListValue* encodings = new ListValue(); | 566 ListValue* encodings = new ListValue(); |
568 encodings->Append(Value::CreateStringValue("UTF-16")); | 567 encodings->Append(Value::CreateStringValue("UTF-16")); |
569 encodings->Append(Value::CreateStringValue("UTF-8")); | 568 encodings->Append(Value::CreateStringValue("UTF-8")); |
570 MockConfigurationPolicyProvider provider; | 569 MockConfigurationPolicyProvider provider; |
571 provider.AddPolicy(kPolicyDefaultSearchProviderEnabled, | 570 provider.AddPolicy(kPolicyDefaultSearchProviderEnabled, base::TrueValue()); |
572 Value::CreateBooleanValue(true)); | |
573 provider.AddPolicy(kPolicyDefaultSearchProviderSearchURL, | 571 provider.AddPolicy(kPolicyDefaultSearchProviderSearchURL, |
574 Value::CreateStringValue(search_url)); | 572 Value::CreateStringValue(search_url)); |
575 provider.AddPolicy(kPolicyDefaultSearchProviderName, | 573 provider.AddPolicy(kPolicyDefaultSearchProviderName, |
576 Value::CreateStringValue(name)); | 574 Value::CreateStringValue(name)); |
577 provider.AddPolicy(kPolicyDefaultSearchProviderKeyword, | 575 provider.AddPolicy(kPolicyDefaultSearchProviderKeyword, |
578 Value::CreateStringValue(keyword)); | 576 Value::CreateStringValue(keyword)); |
579 provider.AddPolicy(kPolicyDefaultSearchProviderSuggestURL, | 577 provider.AddPolicy(kPolicyDefaultSearchProviderSuggestURL, |
580 Value::CreateStringValue(suggest_url)); | 578 Value::CreateStringValue(suggest_url)); |
581 provider.AddPolicy(kPolicyDefaultSearchProviderIconURL, | 579 provider.AddPolicy(kPolicyDefaultSearchProviderIconURL, |
582 Value::CreateStringValue(icon_url)); | 580 Value::CreateStringValue(icon_url)); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 // default search policy will be present. | 613 // default search policy will be present. |
616 TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, MissingUrl) { | 614 TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, MissingUrl) { |
617 const char* const suggest_url = "http://test.com/sugg?t={searchTerms}"; | 615 const char* const suggest_url = "http://test.com/sugg?t={searchTerms}"; |
618 const char* const icon_url = "http://test.com/icon.jpg"; | 616 const char* const icon_url = "http://test.com/icon.jpg"; |
619 const char* const name = "MyName"; | 617 const char* const name = "MyName"; |
620 const char* const keyword = "MyKeyword"; | 618 const char* const keyword = "MyKeyword"; |
621 ListValue* encodings = new ListValue(); | 619 ListValue* encodings = new ListValue(); |
622 encodings->Append(Value::CreateStringValue("UTF-16")); | 620 encodings->Append(Value::CreateStringValue("UTF-16")); |
623 encodings->Append(Value::CreateStringValue("UTF-8")); | 621 encodings->Append(Value::CreateStringValue("UTF-8")); |
624 MockConfigurationPolicyProvider provider; | 622 MockConfigurationPolicyProvider provider; |
625 provider.AddPolicy(kPolicyDefaultSearchProviderEnabled, | 623 provider.AddPolicy(kPolicyDefaultSearchProviderEnabled, base::TrueValue()); |
626 Value::CreateBooleanValue(true)); | |
627 provider.AddPolicy(kPolicyDefaultSearchProviderName, | 624 provider.AddPolicy(kPolicyDefaultSearchProviderName, |
628 Value::CreateStringValue(name)); | 625 Value::CreateStringValue(name)); |
629 provider.AddPolicy(kPolicyDefaultSearchProviderKeyword, | 626 provider.AddPolicy(kPolicyDefaultSearchProviderKeyword, |
630 Value::CreateStringValue(keyword)); | 627 Value::CreateStringValue(keyword)); |
631 provider.AddPolicy(kPolicyDefaultSearchProviderSuggestURL, | 628 provider.AddPolicy(kPolicyDefaultSearchProviderSuggestURL, |
632 Value::CreateStringValue(suggest_url)); | 629 Value::CreateStringValue(suggest_url)); |
633 provider.AddPolicy(kPolicyDefaultSearchProviderIconURL, | 630 provider.AddPolicy(kPolicyDefaultSearchProviderIconURL, |
634 Value::CreateStringValue(icon_url)); | 631 Value::CreateStringValue(icon_url)); |
635 provider.AddPolicy(kPolicyDefaultSearchProviderEncodings, encodings); | 632 provider.AddPolicy(kPolicyDefaultSearchProviderEncodings, encodings); |
636 | 633 |
(...skipping 19 matching lines...) Expand all Loading... |
656 TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, Invalid) { | 653 TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, Invalid) { |
657 const char* const bad_search_url = "http://test.com/noSearchTerms"; | 654 const char* const bad_search_url = "http://test.com/noSearchTerms"; |
658 const char* const suggest_url = "http://test.com/sugg?t={searchTerms}"; | 655 const char* const suggest_url = "http://test.com/sugg?t={searchTerms}"; |
659 const char* const icon_url = "http://test.com/icon.jpg"; | 656 const char* const icon_url = "http://test.com/icon.jpg"; |
660 const char* const name = "MyName"; | 657 const char* const name = "MyName"; |
661 const char* const keyword = "MyKeyword"; | 658 const char* const keyword = "MyKeyword"; |
662 ListValue* encodings = new ListValue(); | 659 ListValue* encodings = new ListValue(); |
663 encodings->Append(Value::CreateStringValue("UTF-16")); | 660 encodings->Append(Value::CreateStringValue("UTF-16")); |
664 encodings->Append(Value::CreateStringValue("UTF-8")); | 661 encodings->Append(Value::CreateStringValue("UTF-8")); |
665 MockConfigurationPolicyProvider provider; | 662 MockConfigurationPolicyProvider provider; |
666 provider.AddPolicy(kPolicyDefaultSearchProviderEnabled, | 663 provider.AddPolicy(kPolicyDefaultSearchProviderEnabled, base::TrueValue()); |
667 Value::CreateBooleanValue(true)); | |
668 provider.AddPolicy(kPolicyDefaultSearchProviderSearchURL, | 664 provider.AddPolicy(kPolicyDefaultSearchProviderSearchURL, |
669 Value::CreateStringValue(bad_search_url)); | 665 Value::CreateStringValue(bad_search_url)); |
670 provider.AddPolicy(kPolicyDefaultSearchProviderName, | 666 provider.AddPolicy(kPolicyDefaultSearchProviderName, |
671 Value::CreateStringValue(name)); | 667 Value::CreateStringValue(name)); |
672 provider.AddPolicy(kPolicyDefaultSearchProviderKeyword, | 668 provider.AddPolicy(kPolicyDefaultSearchProviderKeyword, |
673 Value::CreateStringValue(keyword)); | 669 Value::CreateStringValue(keyword)); |
674 provider.AddPolicy(kPolicyDefaultSearchProviderSuggestURL, | 670 provider.AddPolicy(kPolicyDefaultSearchProviderSuggestURL, |
675 Value::CreateStringValue(suggest_url)); | 671 Value::CreateStringValue(suggest_url)); |
676 provider.AddPolicy(kPolicyDefaultSearchProviderIconURL, | 672 provider.AddPolicy(kPolicyDefaultSearchProviderIconURL, |
677 Value::CreateStringValue(icon_url)); | 673 Value::CreateStringValue(icon_url)); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 class ConfigurationPolicyPrefStoreSyncTest | 786 class ConfigurationPolicyPrefStoreSyncTest |
791 : public ConfigurationPolicyPrefStoreTestBase<testing::Test> { | 787 : public ConfigurationPolicyPrefStoreTestBase<testing::Test> { |
792 }; | 788 }; |
793 | 789 |
794 TEST_F(ConfigurationPolicyPrefStoreSyncTest, Default) { | 790 TEST_F(ConfigurationPolicyPrefStoreSyncTest, Default) { |
795 EXPECT_EQ(PrefStore::READ_NO_VALUE, | 791 EXPECT_EQ(PrefStore::READ_NO_VALUE, |
796 store_->GetValue(prefs::kSyncManaged, NULL)); | 792 store_->GetValue(prefs::kSyncManaged, NULL)); |
797 } | 793 } |
798 | 794 |
799 TEST_F(ConfigurationPolicyPrefStoreSyncTest, Enabled) { | 795 TEST_F(ConfigurationPolicyPrefStoreSyncTest, Enabled) { |
800 provider_.AddPolicy(kPolicySyncDisabled, Value::CreateBooleanValue(false)); | 796 provider_.AddPolicy(kPolicySyncDisabled, base::FalseValue()); |
801 store_->OnUpdatePolicy(); | 797 store_->OnUpdatePolicy(); |
802 // Enabling Sync should not set the pref. | 798 // Enabling Sync should not set the pref. |
803 EXPECT_EQ(PrefStore::READ_NO_VALUE, | 799 EXPECT_EQ(PrefStore::READ_NO_VALUE, |
804 store_->GetValue(prefs::kSyncManaged, NULL)); | 800 store_->GetValue(prefs::kSyncManaged, NULL)); |
805 } | 801 } |
806 | 802 |
807 TEST_F(ConfigurationPolicyPrefStoreSyncTest, Disabled) { | 803 TEST_F(ConfigurationPolicyPrefStoreSyncTest, Disabled) { |
808 provider_.AddPolicy(kPolicySyncDisabled, Value::CreateBooleanValue(true)); | 804 provider_.AddPolicy(kPolicySyncDisabled, base::TrueValue()); |
809 store_->OnUpdatePolicy(); | 805 store_->OnUpdatePolicy(); |
810 // Sync should be flagged as managed. | 806 // Sync should be flagged as managed. |
811 const Value* value = NULL; | 807 const Value* value = NULL; |
812 EXPECT_EQ(PrefStore::READ_OK, store_->GetValue(prefs::kSyncManaged, &value)); | 808 EXPECT_EQ(PrefStore::READ_OK, store_->GetValue(prefs::kSyncManaged, &value)); |
813 ASSERT_TRUE(value); | 809 ASSERT_TRUE(value); |
814 bool sync_managed = false; | 810 bool sync_managed = false; |
815 bool result = value->GetAsBoolean(&sync_managed); | 811 bool result = value->GetAsBoolean(&sync_managed); |
816 ASSERT_TRUE(result); | 812 ASSERT_TRUE(result); |
817 EXPECT_TRUE(sync_managed); | 813 EXPECT_TRUE(sync_managed); |
818 } | 814 } |
(...skipping 25 matching lines...) Expand all Loading... |
844 bool result = value->GetAsBoolean(&prompt_for_download); | 840 bool result = value->GetAsBoolean(&prompt_for_download); |
845 ASSERT_TRUE(result); | 841 ASSERT_TRUE(result); |
846 EXPECT_FALSE(prompt_for_download); | 842 EXPECT_FALSE(prompt_for_download); |
847 } | 843 } |
848 #endif // !defined(OS_CHROMEOS) | 844 #endif // !defined(OS_CHROMEOS) |
849 | 845 |
850 TEST_F(ConfigurationPolicyPrefStorePromptDownloadTest, | 846 TEST_F(ConfigurationPolicyPrefStorePromptDownloadTest, |
851 EnableFileSelectionDialogs) { | 847 EnableFileSelectionDialogs) { |
852 EXPECT_EQ(PrefStore::READ_NO_VALUE, | 848 EXPECT_EQ(PrefStore::READ_NO_VALUE, |
853 store_->GetValue(prefs::kPromptForDownload, NULL)); | 849 store_->GetValue(prefs::kPromptForDownload, NULL)); |
854 provider_.AddPolicy(kPolicyAllowFileSelectionDialogs, | 850 provider_.AddPolicy(kPolicyAllowFileSelectionDialogs, base::TrueValue()); |
855 Value::CreateBooleanValue(true)); | |
856 store_->OnUpdatePolicy(); | 851 store_->OnUpdatePolicy(); |
857 | 852 |
858 // Allowing file-selection dialogs should not influence the PromptForDownload | 853 // Allowing file-selection dialogs should not influence the PromptForDownload |
859 // pref. | 854 // pref. |
860 EXPECT_EQ(PrefStore::READ_NO_VALUE, | 855 EXPECT_EQ(PrefStore::READ_NO_VALUE, |
861 store_->GetValue(prefs::kPromptForDownload, NULL)); | 856 store_->GetValue(prefs::kPromptForDownload, NULL)); |
862 } | 857 } |
863 | 858 |
864 TEST_F(ConfigurationPolicyPrefStorePromptDownloadTest, | 859 TEST_F(ConfigurationPolicyPrefStorePromptDownloadTest, |
865 DisableFileSelectionDialogs) { | 860 DisableFileSelectionDialogs) { |
866 EXPECT_EQ(PrefStore::READ_NO_VALUE, | 861 EXPECT_EQ(PrefStore::READ_NO_VALUE, |
867 store_->GetValue(prefs::kPromptForDownload, NULL)); | 862 store_->GetValue(prefs::kPromptForDownload, NULL)); |
868 provider_.AddPolicy(kPolicyAllowFileSelectionDialogs, | 863 provider_.AddPolicy(kPolicyAllowFileSelectionDialogs, base::FalseValue()); |
869 Value::CreateBooleanValue(false)); | |
870 store_->OnUpdatePolicy(); | 864 store_->OnUpdatePolicy(); |
871 | 865 |
872 // Disabling file-selection dialogs should disable the PromptForDownload pref. | 866 // Disabling file-selection dialogs should disable the PromptForDownload pref. |
873 const Value* value = NULL; | 867 const Value* value = NULL; |
874 EXPECT_EQ(PrefStore::READ_OK, store_->GetValue(prefs::kPromptForDownload, | 868 EXPECT_EQ(PrefStore::READ_OK, store_->GetValue(prefs::kPromptForDownload, |
875 &value)); | 869 &value)); |
876 ASSERT_TRUE(value); | 870 ASSERT_TRUE(value); |
877 bool prompt_for_download = true; | 871 bool prompt_for_download = true; |
878 bool result = value->GetAsBoolean(&prompt_for_download); | 872 bool result = value->GetAsBoolean(&prompt_for_download); |
879 ASSERT_TRUE(result); | 873 ASSERT_TRUE(result); |
880 EXPECT_FALSE(prompt_for_download); | 874 EXPECT_FALSE(prompt_for_download); |
881 } | 875 } |
882 | 876 |
883 // Test cases for the Autofill policy setting. | 877 // Test cases for the Autofill policy setting. |
884 class ConfigurationPolicyPrefStoreAutofillTest | 878 class ConfigurationPolicyPrefStoreAutofillTest |
885 : public ConfigurationPolicyPrefStoreTestBase<testing::Test> { | 879 : public ConfigurationPolicyPrefStoreTestBase<testing::Test> { |
886 }; | 880 }; |
887 | 881 |
888 TEST_F(ConfigurationPolicyPrefStoreAutofillTest, Default) { | 882 TEST_F(ConfigurationPolicyPrefStoreAutofillTest, Default) { |
889 EXPECT_EQ(PrefStore::READ_NO_VALUE, | 883 EXPECT_EQ(PrefStore::READ_NO_VALUE, |
890 store_->GetValue(prefs::kSyncManaged, NULL)); | 884 store_->GetValue(prefs::kSyncManaged, NULL)); |
891 } | 885 } |
892 | 886 |
893 TEST_F(ConfigurationPolicyPrefStoreAutofillTest, Enabled) { | 887 TEST_F(ConfigurationPolicyPrefStoreAutofillTest, Enabled) { |
894 provider_.AddPolicy(kPolicyAutoFillEnabled, Value::CreateBooleanValue(true)); | 888 provider_.AddPolicy(kPolicyAutoFillEnabled, base::TrueValue()); |
895 store_->OnUpdatePolicy(); | 889 store_->OnUpdatePolicy(); |
896 // Enabling Autofill should not set the pref. | 890 // Enabling Autofill should not set the pref. |
897 EXPECT_EQ(PrefStore::READ_NO_VALUE, | 891 EXPECT_EQ(PrefStore::READ_NO_VALUE, |
898 store_->GetValue(prefs::kSyncManaged, NULL)); | 892 store_->GetValue(prefs::kSyncManaged, NULL)); |
899 } | 893 } |
900 | 894 |
901 TEST_F(ConfigurationPolicyPrefStoreAutofillTest, Disabled) { | 895 TEST_F(ConfigurationPolicyPrefStoreAutofillTest, Disabled) { |
902 provider_.AddPolicy(kPolicyAutoFillEnabled, Value::CreateBooleanValue(false)); | 896 provider_.AddPolicy(kPolicyAutoFillEnabled, base::FalseValue()); |
903 store_->OnUpdatePolicy(); | 897 store_->OnUpdatePolicy(); |
904 // Disabling Autofill should switch the pref to managed. | 898 // Disabling Autofill should switch the pref to managed. |
905 const Value* value = NULL; | 899 const Value* value = NULL; |
906 EXPECT_EQ(PrefStore::READ_OK, | 900 EXPECT_EQ(PrefStore::READ_OK, |
907 store_->GetValue(prefs::kAutofillEnabled, &value)); | 901 store_->GetValue(prefs::kAutofillEnabled, &value)); |
908 ASSERT_TRUE(value); | 902 ASSERT_TRUE(value); |
909 bool autofill_enabled = true; | 903 bool autofill_enabled = true; |
910 bool result = value->GetAsBoolean(&autofill_enabled); | 904 bool result = value->GetAsBoolean(&autofill_enabled); |
911 ASSERT_TRUE(result); | 905 ASSERT_TRUE(result); |
912 EXPECT_FALSE(autofill_enabled); | 906 EXPECT_FALSE(autofill_enabled); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 | 954 |
961 provider_.SetInitializationComplete(true); | 955 provider_.SetInitializationComplete(true); |
962 EXPECT_FALSE(store_->IsInitializationComplete()); | 956 EXPECT_FALSE(store_->IsInitializationComplete()); |
963 | 957 |
964 store_->OnUpdatePolicy(); | 958 store_->OnUpdatePolicy(); |
965 Mock::VerifyAndClearExpectations(&observer_); | 959 Mock::VerifyAndClearExpectations(&observer_); |
966 EXPECT_TRUE(store_->IsInitializationComplete()); | 960 EXPECT_TRUE(store_->IsInitializationComplete()); |
967 } | 961 } |
968 | 962 |
969 } // namespace policy | 963 } // namespace policy |
OLD | NEW |