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/files/file_util.h" | 5 #include "base/files/file_util.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 ~ExtensionToolbarModelTestObserver() override; | 46 ~ExtensionToolbarModelTestObserver() override; |
47 | 47 |
48 size_t inserted_count() const { return inserted_count_; } | 48 size_t inserted_count() const { return inserted_count_; } |
49 size_t removed_count() const { return removed_count_; } | 49 size_t removed_count() const { return removed_count_; } |
50 size_t moved_count() const { return moved_count_; } | 50 size_t moved_count() const { return moved_count_; } |
51 int highlight_mode_count() const { return highlight_mode_count_; } | 51 int highlight_mode_count() const { return highlight_mode_count_; } |
52 size_t initialized_count() const { return initialized_count_; } | 52 size_t initialized_count() const { return initialized_count_; } |
53 | 53 |
54 private: | 54 private: |
55 // ExtensionToolbarModel::Observer: | 55 // ExtensionToolbarModel::Observer: |
56 void ToolbarExtensionAdded(const Extension* extension, int index) override { | 56 void OnToolbarExtensionAdded(const Extension* extension, int index) override { |
57 ++inserted_count_; | 57 ++inserted_count_; |
58 } | 58 } |
59 | 59 |
60 void ToolbarExtensionRemoved(const Extension* extension) override { | 60 void OnToolbarExtensionRemoved(const Extension* extension) override { |
61 ++removed_count_; | 61 ++removed_count_; |
62 } | 62 } |
63 | 63 |
64 void ToolbarExtensionMoved(const Extension* extension, int index) override { | 64 void OnToolbarExtensionMoved(const Extension* extension, int index) override { |
65 ++moved_count_; | 65 ++moved_count_; |
66 } | 66 } |
67 | 67 |
68 void ToolbarExtensionUpdated(const Extension* extension) override {} | 68 void OnToolbarExtensionUpdated(const Extension* extension) override {} |
69 | 69 |
70 bool ShowExtensionActionPopup(const Extension* extension, | 70 bool ShowExtensionActionPopup(const Extension* extension, |
71 bool grant_active_tab) override { | 71 bool grant_active_tab) override { |
72 return false; | 72 return false; |
73 } | 73 } |
74 | 74 |
75 void ToolbarVisibleCountChanged() override {} | 75 void OnToolbarVisibleCountChanged() override {} |
76 | 76 |
77 void ToolbarHighlightModeChanged(bool is_highlighting) override { | 77 void OnToolbarHighlightModeChanged(bool is_highlighting) override { |
78 // Add one if highlighting, subtract one if not. | 78 // Add one if highlighting, subtract one if not. |
79 highlight_mode_count_ += is_highlighting ? 1 : -1; | 79 highlight_mode_count_ += is_highlighting ? 1 : -1; |
80 } | 80 } |
81 | 81 |
82 void OnToolbarModelInitialized() override { ++initialized_count_; } | 82 void OnToolbarModelInitialized() override { ++initialized_count_; } |
83 | 83 |
84 Browser* GetBrowser() override { return NULL; } | 84 Browser* GetBrowser() override { return NULL; } |
85 | 85 |
86 ExtensionToolbarModel* model_; | 86 ExtensionToolbarModel* model_; |
87 | 87 |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 | 1123 |
1124 // The new order should be reflected in the model. | 1124 // The new order should be reflected in the model. |
1125 EXPECT_EQ(browser_action_b(), GetExtensionAtIndex(0)); | 1125 EXPECT_EQ(browser_action_b(), GetExtensionAtIndex(0)); |
1126 EXPECT_EQ(browser_action_c(), GetExtensionAtIndex(1)); | 1126 EXPECT_EQ(browser_action_c(), GetExtensionAtIndex(1)); |
1127 EXPECT_EQ(browser_action_a(), GetExtensionAtIndex(2)); | 1127 EXPECT_EQ(browser_action_a(), GetExtensionAtIndex(2)); |
1128 EXPECT_EQ(inserted_and_removed_difference, | 1128 EXPECT_EQ(inserted_and_removed_difference, |
1129 observer()->inserted_count() - observer()->removed_count()); | 1129 observer()->inserted_count() - observer()->removed_count()); |
1130 } | 1130 } |
1131 | 1131 |
1132 } // namespace extensions | 1132 } // namespace extensions |
OLD | NEW |