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 "chrome/browser/extensions/extension_action_manager.h" | 5 #include "chrome/browser/extensions/extension_action_manager.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "chrome/browser/extensions/extension_action.h" | 8 #include "chrome/browser/extensions/extension_action.h" |
9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
10 #include "content/public/test/test_browser_thread_bundle.h" | 10 #include "content/public/test/test_browser_thread_bundle.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 std::string id = base::IntToString(curr_id_++); | 77 std::string id = base::IntToString(curr_id_++); |
78 scoped_refptr<Extension> extension = | 78 scoped_refptr<Extension> extension = |
79 ExtensionBuilder() | 79 ExtensionBuilder() |
80 .SetManifest(std::move( | 80 .SetManifest(std::move( |
81 DictionaryBuilder() | 81 DictionaryBuilder() |
82 .Set("version", "1") | 82 .Set("version", "1") |
83 .Set("manifest_version", 2) | 83 .Set("manifest_version", 2) |
84 .Set("icons", std::move(extension_icons)) | 84 .Set("icons", std::move(extension_icons)) |
85 .Set(action_type, std::move(action)) | 85 .Set(action_type, std::move(action)) |
86 .Set("name", std::string("Test Extension").append(id)))) | 86 .Set("name", std::string("Test Extension").append(id)))) |
87 .SetLocation(Manifest::UNPACKED) | |
88 .SetID(id) | 87 .SetID(id) |
89 .Build(); | 88 .Build(); |
90 registry_->AddEnabled(extension); | 89 registry_->AddEnabled(extension); |
91 return extension; | 90 return extension; |
92 } | 91 } |
93 | 92 |
94 bool ExtensionActionManagerTest::TitlesMatch(const Extension& extension, | 93 bool ExtensionActionManagerTest::TitlesMatch(const Extension& extension, |
95 const ExtensionAction& action) { | 94 const ExtensionAction& action) { |
96 return action.GetTitle(ExtensionAction::kDefaultTabId) == extension.name(); | 95 return action.GetTitle(ExtensionAction::kDefaultTabId) == extension.name(); |
97 } | 96 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 manager()->GetBestFitAction(*extension.get(), ActionInfo::TYPE_BROWSER); | 221 manager()->GetBestFitAction(*extension.get(), ActionInfo::TYPE_BROWSER); |
223 | 222 |
224 // Now these values match because |extension| does not have page action | 223 // Now these values match because |extension| does not have page action |
225 // defaults. | 224 // defaults. |
226 ASSERT_TRUE(TitlesMatch(*extension.get(), *action)); | 225 ASSERT_TRUE(TitlesMatch(*extension.get(), *action)); |
227 ASSERT_TRUE(IconsMatch(*extension.get(), 48, *action, 38)); | 226 ASSERT_TRUE(IconsMatch(*extension.get(), 48, *action, 38)); |
228 } | 227 } |
229 | 228 |
230 } // namespace | 229 } // namespace |
231 } // namespace extensions | 230 } // namespace extensions |
OLD | NEW |