| 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 "chrome/browser/extensions/extension_prefs_unittest.h" | 5 #include "chrome/browser/extensions/extension_prefs_unittest.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/prefs/mock_pref_change_callback.h" | 10 #include "base/prefs/mock_pref_change_callback.h" |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 444 |
| 445 private: | 445 private: |
| 446 ExtensionList extensions_; | 446 ExtensionList extensions_; |
| 447 | 447 |
| 448 std::string not_installed_id_; | 448 std::string not_installed_id_; |
| 449 std::string external_id_; | 449 std::string external_id_; |
| 450 std::string blacklisted_id_; | 450 std::string blacklisted_id_; |
| 451 }; | 451 }; |
| 452 TEST_F(ExtensionPrefsAcknowledgment, Acknowledgment) {} | 452 TEST_F(ExtensionPrefsAcknowledgment, Acknowledgment) {} |
| 453 | 453 |
| 454 // Tests force hiding browser actions. | |
| 455 class ExtensionPrefsHidingBrowserActions : public ExtensionPrefsTest { | |
| 456 public: | |
| 457 virtual void Initialize() OVERRIDE { | |
| 458 // Install 5 extensions. | |
| 459 for (int i = 0; i < 5; i++) { | |
| 460 std::string name = "test" + base::IntToString(i); | |
| 461 extensions_.push_back(prefs_.AddExtension(name)); | |
| 462 } | |
| 463 | |
| 464 ExtensionList::const_iterator iter; | |
| 465 for (iter = extensions_.begin(); iter != extensions_.end(); ++iter) | |
| 466 EXPECT_TRUE(prefs()->GetBrowserActionVisibility(*iter)); | |
| 467 | |
| 468 prefs()->SetBrowserActionVisibility(extensions_[0], false); | |
| 469 prefs()->SetBrowserActionVisibility(extensions_[1], true); | |
| 470 } | |
| 471 | |
| 472 virtual void Verify() OVERRIDE { | |
| 473 // Make sure the one we hid is hidden. | |
| 474 EXPECT_FALSE(prefs()->GetBrowserActionVisibility(extensions_[0])); | |
| 475 | |
| 476 // Make sure the other id's are not hidden. | |
| 477 ExtensionList::const_iterator iter = extensions_.begin() + 1; | |
| 478 for (; iter != extensions_.end(); ++iter) { | |
| 479 SCOPED_TRACE(base::StringPrintf("Loop %d ", | |
| 480 static_cast<int>(iter - extensions_.begin()))); | |
| 481 EXPECT_TRUE(prefs()->GetBrowserActionVisibility(*iter)); | |
| 482 } | |
| 483 } | |
| 484 | |
| 485 private: | |
| 486 ExtensionList extensions_; | |
| 487 }; | |
| 488 TEST_F(ExtensionPrefsHidingBrowserActions, ForceHide) {} | |
| 489 | |
| 490 // Tests the idle install information functions. | 454 // Tests the idle install information functions. |
| 491 class ExtensionPrefsDelayedInstallInfo : public ExtensionPrefsTest { | 455 class ExtensionPrefsDelayedInstallInfo : public ExtensionPrefsTest { |
| 492 public: | 456 public: |
| 493 // Sets idle install information for one test extension. | 457 // Sets idle install information for one test extension. |
| 494 void SetIdleInfo(std::string id, int num) { | 458 void SetIdleInfo(std::string id, int num) { |
| 495 DictionaryValue manifest; | 459 DictionaryValue manifest; |
| 496 manifest.SetString(extension_manifest_keys::kName, "test"); | 460 manifest.SetString(extension_manifest_keys::kName, "test"); |
| 497 manifest.SetString(extension_manifest_keys::kVersion, | 461 manifest.SetString(extension_manifest_keys::kVersion, |
| 498 "1." + base::IntToString(num)); | 462 "1." + base::IntToString(num)); |
| 499 base::FilePath path = | 463 base::FilePath path = |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 | 1118 |
| 1155 private: | 1119 private: |
| 1156 scoped_refptr<const Extension> extension_a_; | 1120 scoped_refptr<const Extension> extension_a_; |
| 1157 scoped_refptr<const Extension> extension_b_; | 1121 scoped_refptr<const Extension> extension_b_; |
| 1158 scoped_refptr<const Extension> extension_c_; | 1122 scoped_refptr<const Extension> extension_c_; |
| 1159 }; | 1123 }; |
| 1160 TEST_F(ExtensionPrefsBlacklistedExtensions, | 1124 TEST_F(ExtensionPrefsBlacklistedExtensions, |
| 1161 ExtensionPrefsBlacklistedExtensions) {} | 1125 ExtensionPrefsBlacklistedExtensions) {} |
| 1162 | 1126 |
| 1163 } // namespace extensions | 1127 } // namespace extensions |
| OLD | NEW |