| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
| 10 #include "chrome/common/extensions/api/extension_action/action_info.h" | 10 #include "chrome/common/extensions/api/extension_action/action_info.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 const std::string name("MyExtensionActionName"); | 74 const std::string name("MyExtensionActionName"); |
| 75 std::string img1("image1.png"); | 75 std::string img1("image1.png"); |
| 76 | 76 |
| 77 action = LoadAction("page_action.json"); | 77 action = LoadAction("page_action.json"); |
| 78 ASSERT_TRUE(action); | 78 ASSERT_TRUE(action); |
| 79 ASSERT_EQ(id, action->id); | 79 ASSERT_EQ(id, action->id); |
| 80 | 80 |
| 81 // No title, so fall back to name. | 81 // No title, so fall back to name. |
| 82 ASSERT_EQ(name, action->default_title); | 82 ASSERT_EQ(name, action->default_title); |
| 83 ASSERT_EQ(img1, | 83 ASSERT_EQ(img1, |
| 84 action->default_icon.Get(extension_misc::EXTENSION_ICON_ACTION, | 84 action->default_icon.Get(19, ExtensionIconSet::MATCH_EXACTLY)); |
| 85 ExtensionIconSet::MATCH_EXACTLY)); | |
| 86 | 85 |
| 87 // Same test with explicitly set type. | 86 // Same test with explicitly set type. |
| 88 action = LoadAction("page_action_type.json"); | 87 action = LoadAction("page_action_type.json"); |
| 89 ASSERT_TRUE(action); | 88 ASSERT_TRUE(action); |
| 90 | 89 |
| 91 // Try an action without id key. | 90 // Try an action without id key. |
| 92 action = LoadAction("page_action_no_id.json"); | 91 action = LoadAction("page_action_no_id.json"); |
| 93 ASSERT_TRUE(action); | 92 ASSERT_TRUE(action); |
| 94 | 93 |
| 95 // Then try without the name key. It's optional, so no error. | 94 // Then try without the name key. It's optional, so no error. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 action = LoadAction("page_action_empty_popup.json"); | 163 action = LoadAction("page_action_empty_popup.json"); |
| 165 | 164 |
| 166 ASSERT_TRUE(action); | 165 ASSERT_TRUE(action); |
| 167 EXPECT_TRUE(action->default_popup_url.is_empty()); | 166 EXPECT_TRUE(action->default_popup_url.is_empty()); |
| 168 ASSERT_STREQ( | 167 ASSERT_STREQ( |
| 169 "", | 168 "", |
| 170 action->default_popup_url.spec().c_str()); | 169 action->default_popup_url.spec().c_str()); |
| 171 } | 170 } |
| 172 | 171 |
| 173 } // namespace extensions | 172 } // namespace extensions |
| OLD | NEW |