Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/values.h" | 6 #include "base/values.h" |
| 7 #include "chrome/browser/extensions/extension_pref_value_map.h" | 7 #include "chrome/browser/extensions/extension_pref_value_map.h" |
| 8 #include "chrome/browser/extensions/extension_pref_value_map_factory.h" | 8 #include "chrome/browser/extensions/extension_pref_value_map_factory.h" |
| 9 #include "chrome/browser/extensions/extension_prefs.h" | 9 #include "chrome/browser/extensions/extension_prefs.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 EXPECT_FALSE(IsSignatureValid()); | 125 EXPECT_FALSE(IsSignatureValid()); |
| 126 | 126 |
| 127 // Flip another pref value of that extension. | 127 // Flip another pref value of that extension. |
| 128 extension_prefs->SetIsIncognitoEnabled( | 128 extension_prefs->SetIsIncognitoEnabled( |
| 129 sample_id, !extension_prefs->IsIncognitoEnabled(sample_id)); | 129 sample_id, !extension_prefs->IsIncognitoEnabled(sample_id)); |
| 130 | 130 |
| 131 // No changes to the backup and signature. | 131 // No changes to the backup and signature. |
| 132 EXPECT_FALSE(IsSignatureValid()); | 132 EXPECT_FALSE(IsSignatureValid()); |
| 133 | 133 |
| 134 // Blacklisting the extension does update the backup and signature. | 134 // Blacklisting the extension does update the backup and signature. |
| 135 std::set<std::string> blacklist; | 135 extension_prefs->SetExtensionBlacklisted(sample_id, true); |
| 136 blacklist.insert(sample_id); | |
| 137 extension_prefs->UpdateBlacklist(blacklist); | |
| 138 | 136 |
| 139 EXPECT_TRUE(IsSignatureValid()); | 137 EXPECT_TRUE(IsSignatureValid()); |
|
not at google - send to devlin
2012/12/03 21:27:23
@ivankr this check is failing. Do you know what it
Ivan Korotkov
2012/12/04 12:16:20
ProtectedPrefsWatcher maintains a copy of installe
| |
| 140 } | 138 } |
| 141 | 139 |
| 142 // Verify that version bigger than 1 is included in the signature. | 140 // Verify that version bigger than 1 is included in the signature. |
| 143 TEST_F(ProtectedPrefsWatcherTest, VersionIsSigned) { | 141 TEST_F(ProtectedPrefsWatcherTest, VersionIsSigned) { |
| 144 // Reset version to 1. | 142 // Reset version to 1. |
| 145 prefs_->ClearPref("backup._version"); | 143 prefs_->ClearPref("backup._version"); |
| 146 // This should make the backup invalid. | 144 // This should make the backup invalid. |
| 147 EXPECT_FALSE(IsSignatureValid()); | 145 EXPECT_FALSE(IsSignatureValid()); |
| 148 | 146 |
| 149 // "Migrate" the backup back to the latest version. | 147 // "Migrate" the backup back to the latest version. |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 std::string(prefs::kHomePageIsNewTabPage)); | 282 std::string(prefs::kHomePageIsNewTabPage)); |
| 285 EXPECT_EQ("browser.show_home_button", std::string(prefs::kShowHomeButton)); | 283 EXPECT_EQ("browser.show_home_button", std::string(prefs::kShowHomeButton)); |
| 286 EXPECT_EQ("session.restore_on_startup", | 284 EXPECT_EQ("session.restore_on_startup", |
| 287 std::string(prefs::kRestoreOnStartup)); | 285 std::string(prefs::kRestoreOnStartup)); |
| 288 EXPECT_EQ("session.urls_to_restore_on_startup", | 286 EXPECT_EQ("session.urls_to_restore_on_startup", |
| 289 std::string(prefs::kURLsToRestoreOnStartup)); | 287 std::string(prefs::kURLsToRestoreOnStartup)); |
| 290 EXPECT_EQ("pinned_tabs", std::string(prefs::kPinnedTabs)); | 288 EXPECT_EQ("pinned_tabs", std::string(prefs::kPinnedTabs)); |
| 291 } | 289 } |
| 292 | 290 |
| 293 } // namespace protector | 291 } // namespace protector |
| OLD | NEW |