OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/macros.h" | 5 #include "base/macros.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 8 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_service_test_base.h" | 10 #include "chrome/browser/extensions/extension_service_test_base.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 virtual ~ExtensionToolbarModelTestObserver(); | 52 virtual ~ExtensionToolbarModelTestObserver(); |
53 | 53 |
54 size_t inserted_count() const { return inserted_count_; } | 54 size_t inserted_count() const { return inserted_count_; } |
55 size_t removed_count() const { return removed_count_; } | 55 size_t removed_count() const { return removed_count_; } |
56 size_t moved_count() const { return moved_count_; } | 56 size_t moved_count() const { return moved_count_; } |
57 int highlight_mode_count() const { return highlight_mode_count_; } | 57 int highlight_mode_count() const { return highlight_mode_count_; } |
58 | 58 |
59 private: | 59 private: |
60 // ExtensionToolbarModel::Observer: | 60 // ExtensionToolbarModel::Observer: |
61 virtual void ToolbarExtensionAdded(const Extension* extension, | 61 virtual void ToolbarExtensionAdded(const Extension* extension, |
62 int index) OVERRIDE { | 62 int index) override { |
63 ++inserted_count_; | 63 ++inserted_count_; |
64 } | 64 } |
65 | 65 |
66 virtual void ToolbarExtensionRemoved(const Extension* extension) OVERRIDE { | 66 virtual void ToolbarExtensionRemoved(const Extension* extension) override { |
67 ++removed_count_; | 67 ++removed_count_; |
68 } | 68 } |
69 | 69 |
70 virtual void ToolbarExtensionMoved(const Extension* extension, | 70 virtual void ToolbarExtensionMoved(const Extension* extension, |
71 int index) OVERRIDE { | 71 int index) override { |
72 ++moved_count_; | 72 ++moved_count_; |
73 } | 73 } |
74 | 74 |
75 virtual void ToolbarExtensionUpdated(const Extension* extension) OVERRIDE { | 75 virtual void ToolbarExtensionUpdated(const Extension* extension) override { |
76 } | 76 } |
77 | 77 |
78 virtual bool ShowExtensionActionPopup(const Extension* extension, | 78 virtual bool ShowExtensionActionPopup(const Extension* extension, |
79 bool grant_active_tab) OVERRIDE { | 79 bool grant_active_tab) override { |
80 return false; | 80 return false; |
81 } | 81 } |
82 | 82 |
83 virtual void ToolbarVisibleCountChanged() OVERRIDE { | 83 virtual void ToolbarVisibleCountChanged() override { |
84 } | 84 } |
85 | 85 |
86 virtual void ToolbarHighlightModeChanged(bool is_highlighting) OVERRIDE { | 86 virtual void ToolbarHighlightModeChanged(bool is_highlighting) override { |
87 // Add one if highlighting, subtract one if not. | 87 // Add one if highlighting, subtract one if not. |
88 highlight_mode_count_ += is_highlighting ? 1 : -1; | 88 highlight_mode_count_ += is_highlighting ? 1 : -1; |
89 } | 89 } |
90 | 90 |
91 virtual Browser* GetBrowser() OVERRIDE { | 91 virtual Browser* GetBrowser() override { |
92 return NULL; | 92 return NULL; |
93 } | 93 } |
94 | 94 |
95 ExtensionToolbarModel* model_; | 95 ExtensionToolbarModel* model_; |
96 | 96 |
97 size_t inserted_count_; | 97 size_t inserted_count_; |
98 size_t removed_count_; | 98 size_t removed_count_; |
99 size_t moved_count_; | 99 size_t moved_count_; |
100 // Int because it could become negative (if something goes wrong). | 100 // Int because it could become negative (if something goes wrong). |
101 int highlight_mode_count_; | 101 int highlight_mode_count_; |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 ExtensionActionAPI::SetBrowserActionVisibility( | 811 ExtensionActionAPI::SetBrowserActionVisibility( |
812 prefs, extension_b->id(), true); | 812 prefs, extension_b->id(), true); |
813 EXPECT_EQ(3u, num_toolbar_items()); | 813 EXPECT_EQ(3u, num_toolbar_items()); |
814 EXPECT_EQ(-1, toolbar_model()->GetVisibleIconCount()); // -1 = 'all' | 814 EXPECT_EQ(-1, toolbar_model()->GetVisibleIconCount()); // -1 = 'all' |
815 EXPECT_EQ(extension_c, GetExtensionAtIndex(0u)); | 815 EXPECT_EQ(extension_c, GetExtensionAtIndex(0u)); |
816 EXPECT_EQ(extension_a, GetExtensionAtIndex(1u)); | 816 EXPECT_EQ(extension_a, GetExtensionAtIndex(1u)); |
817 EXPECT_EQ(extension_b, GetExtensionAtIndex(2u)); | 817 EXPECT_EQ(extension_b, GetExtensionAtIndex(2u)); |
818 } | 818 } |
819 | 819 |
820 } // namespace extensions | 820 } // namespace extensions |
OLD | NEW |