1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/extensions/./extension_prefs_unittest.h"
11 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
12 #include "extensions/common/extension.h"
14 namespace extensions
{
16 // Tests force hiding browser actions.
17 class ExtensionPrefsHidingBrowserActions
: public ExtensionPrefsTest
{
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
));
26 ExtensionList::const_iterator iter
;
27 for (iter
= extensions_
.begin(); iter
!= extensions_
.end(); ++iter
) {
28 EXPECT_TRUE(ExtensionActionAPI::GetBrowserActionVisibility(
29 prefs(), (*iter
)->id()));
32 ExtensionActionAPI::SetBrowserActionVisibility(
33 prefs(), extensions_
[0]->id(), false);
34 ExtensionActionAPI::SetBrowserActionVisibility(
35 prefs(), extensions_
[1]->id(), true);
38 virtual void Verify() OVERRIDE
{
39 // Make sure the one we hid is hidden.
40 EXPECT_FALSE(ExtensionActionAPI::GetBrowserActionVisibility(
41 prefs(), extensions_
[0]->id()));
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()));
54 ExtensionList extensions_
;
57 TEST_F(ExtensionPrefsHidingBrowserActions
, ForceHide
) {}
59 } // namespace extensions