Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
|
Yoyo Zhou
2013/05/02 22:50:07
You can give this file a more specific name like e
Devlin
2013/05/03 01:48:46
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include <string> | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "base/stringprintf.h" | |
| 9 #include "base/strings/string_number_conversions.h" | |
| 10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | |
| 11 #include "chrome/browser/extensions/extension_prefs_unittest.h" | |
| 12 #include "chrome/common/extensions/extension.h" | |
| 13 | |
| 14 namespace extensions { | |
| 15 | |
| 16 // Tests force hiding browser actions. | |
| 17 class ExtensionPrefsHidingBrowserActions : public ExtensionPrefsTest { | |
| 18 public: | |
| 19 virtual void Initialize() OVERRIDE { | |
| 20 // Install 5 extensions. | |
| 21 for (int i = 0; i < 5; i++) { | |
| 22 std::string name = "test" + base::IntToString(i); | |
| 23 extensions_.push_back(prefs_.AddExtension(name)); | |
| 24 } | |
| 25 | |
| 26 ExtensionList::const_iterator iter; | |
| 27 for (iter = extensions_.begin(); iter != extensions_.end(); ++iter) { | |
| 28 EXPECT_TRUE(ExtensionActionAPI::GetBrowserActionVisibility( | |
| 29 prefs(), (*iter)->id())); | |
| 30 } | |
| 31 | |
| 32 ExtensionActionAPI::SetBrowserActionVisibility( | |
| 33 prefs(), extensions_[0]->id(), false); | |
| 34 ExtensionActionAPI::SetBrowserActionVisibility( | |
| 35 prefs(), extensions_[1]->id(), true); | |
| 36 } | |
| 37 | |
| 38 virtual void Verify() OVERRIDE { | |
| 39 // Make sure the one we hid is hidden. | |
| 40 EXPECT_FALSE(ExtensionActionAPI::GetBrowserActionVisibility( | |
| 41 prefs(), extensions_[0]->id())); | |
| 42 | |
| 43 // Make sure the other id's are not hidden. | |
| 44 ExtensionList::const_iterator iter = extensions_.begin() + 1; | |
| 45 for (; iter != extensions_.end(); ++iter) { | |
| 46 SCOPED_TRACE(base::StringPrintf("Loop %d ", | |
| 47 static_cast<int>(iter - extensions_.begin()))); | |
| 48 EXPECT_TRUE(ExtensionActionAPI::GetBrowserActionVisibility( | |
| 49 prefs(), (*iter)->id())); | |
| 50 } | |
| 51 } | |
| 52 | |
| 53 private: | |
| 54 ExtensionList extensions_; | |
| 55 }; | |
| 56 | |
| 57 TEST_F(ExtensionPrefsHidingBrowserActions, ForceHide) {} | |
| 58 | |
| 59 } // namespace extensions | |
| OLD | NEW |