| 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) |
| 87 .SetID(id) | 88 .SetID(id) |
| 88 .Build(); | 89 .Build(); |
| 89 registry_->AddEnabled(extension); | 90 registry_->AddEnabled(extension); |
| 90 return extension; | 91 return extension; |
| 91 } | 92 } |
| 92 | 93 |
| 93 bool ExtensionActionManagerTest::TitlesMatch(const Extension& extension, | 94 bool ExtensionActionManagerTest::TitlesMatch(const Extension& extension, |
| 94 const ExtensionAction& action) { | 95 const ExtensionAction& action) { |
| 95 return action.GetTitle(ExtensionAction::kDefaultTabId) == extension.name(); | 96 return action.GetTitle(ExtensionAction::kDefaultTabId) == extension.name(); |
| 96 } | 97 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 manager()->GetBestFitAction(*extension.get(), ActionInfo::TYPE_BROWSER); | 222 manager()->GetBestFitAction(*extension.get(), ActionInfo::TYPE_BROWSER); |
| 222 | 223 |
| 223 // Now these values match because |extension| does not have page action | 224 // Now these values match because |extension| does not have page action |
| 224 // defaults. | 225 // defaults. |
| 225 ASSERT_TRUE(TitlesMatch(*extension.get(), *action)); | 226 ASSERT_TRUE(TitlesMatch(*extension.get(), *action)); |
| 226 ASSERT_TRUE(IconsMatch(*extension.get(), 48, *action, 38)); | 227 ASSERT_TRUE(IconsMatch(*extension.get(), 48, *action, 38)); |
| 227 } | 228 } |
| 228 | 229 |
| 229 } // namespace | 230 } // namespace |
| 230 } // namespace extensions | 231 } // namespace extensions |
| OLD | NEW |