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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/scoped_temp_dir.h" | 7 #include "base/scoped_temp_dir.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 testing::Mock::VerifyAndClearExpectations(v1i); | 1104 testing::Mock::VerifyAndClearExpectations(v1i); |
1105 testing::Mock::VerifyAndClearExpectations(v2); | 1105 testing::Mock::VerifyAndClearExpectations(v2); |
1106 testing::Mock::VerifyAndClearExpectations(v2i); | 1106 testing::Mock::VerifyAndClearExpectations(v2i); |
1107 } | 1107 } |
1108 | 1108 |
1109 virtual void Verify() { | 1109 virtual void Verify() { |
1110 } | 1110 } |
1111 }; | 1111 }; |
1112 TEST_F(ExtensionPrefsSetExtensionControlledPref, | 1112 TEST_F(ExtensionPrefsSetExtensionControlledPref, |
1113 ExtensionPrefsSetExtensionControlledPref) {} | 1113 ExtensionPrefsSetExtensionControlledPref) {} |
| 1114 |
| 1115 // Tests that the switches::kDisableExtensions command-line flag prevents |
| 1116 // extension controlled preferences from being enacted. |
| 1117 class ExtensionPrefsDisableExtensions |
| 1118 : public ExtensionPrefsPreferencesBase { |
| 1119 public: |
| 1120 ExtensionPrefsDisableExtensions() |
| 1121 : iteration_(0) {} |
| 1122 virtual ~ExtensionPrefsDisableExtensions() {} |
| 1123 virtual void Initialize() { |
| 1124 InstallExtControlledPref(ext1_, kPref1, Value::CreateStringValue("val1")); |
| 1125 // This becomes only active in the second verification phase. |
| 1126 prefs_.set_extensions_disabled(true); |
| 1127 } |
| 1128 virtual void Verify() { |
| 1129 std::string actual = prefs()->pref_service()->GetString(kPref1); |
| 1130 if (iteration_ == 0) { |
| 1131 EXPECT_EQ("val1", actual); |
| 1132 ++iteration_; |
| 1133 } else { |
| 1134 EXPECT_EQ(kDefaultPref1, actual); |
| 1135 } |
| 1136 } |
| 1137 |
| 1138 private: |
| 1139 int iteration_; |
| 1140 }; |
| 1141 TEST_F(ExtensionPrefsDisableExtensions, ExtensionPrefsDisableExtensions) {} |
OLD | NEW |