| 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 20 matching lines...) Expand all Loading... |
| 31 std::unique_ptr<ActionInfo> LoadAction(const std::string& manifest_filename); | 31 std::unique_ptr<ActionInfo> LoadAction(const std::string& manifest_filename); |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 std::unique_ptr<ActionInfo> PageActionManifestTest::LoadAction( | 34 std::unique_ptr<ActionInfo> PageActionManifestTest::LoadAction( |
| 35 const std::string& manifest_filename) { | 35 const std::string& manifest_filename) { |
| 36 scoped_refptr<Extension> extension = LoadAndExpectSuccess( | 36 scoped_refptr<Extension> extension = LoadAndExpectSuccess( |
| 37 manifest_filename.c_str()); | 37 manifest_filename.c_str()); |
| 38 const ActionInfo* page_action_info = | 38 const ActionInfo* page_action_info = |
| 39 ActionInfo::GetPageActionInfo(extension.get()); | 39 ActionInfo::GetPageActionInfo(extension.get()); |
| 40 EXPECT_TRUE(page_action_info); | 40 EXPECT_TRUE(page_action_info); |
| 41 if (page_action_info) { | 41 if (page_action_info) |
| 42 return base::WrapUnique(new ActionInfo(*page_action_info)); | 42 return base::MakeUnique<ActionInfo>(*page_action_info); |
| 43 } | |
| 44 ADD_FAILURE() << "Expected manifest in " << manifest_filename | 43 ADD_FAILURE() << "Expected manifest in " << manifest_filename |
| 45 << " to include a page_action section."; | 44 << " to include a page_action section."; |
| 46 return std::unique_ptr<ActionInfo>(); | 45 return nullptr; |
| 47 } | 46 } |
| 48 | 47 |
| 49 TEST_F(PageActionManifestTest, ManifestVersion2) { | 48 TEST_F(PageActionManifestTest, ManifestVersion2) { |
| 50 scoped_refptr<Extension> extension( | 49 scoped_refptr<Extension> extension( |
| 51 LoadAndExpectSuccess("page_action_manifest_version_2.json")); | 50 LoadAndExpectSuccess("page_action_manifest_version_2.json")); |
| 52 ASSERT_TRUE(extension.get()); | 51 ASSERT_TRUE(extension.get()); |
| 53 const ActionInfo* page_action_info = | 52 const ActionInfo* page_action_info = |
| 54 ActionInfo::GetPageActionInfo(extension.get()); | 53 ActionInfo::GetPageActionInfo(extension.get()); |
| 55 ASSERT_TRUE(page_action_info); | 54 ASSERT_TRUE(page_action_info); |
| 56 | 55 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 action = LoadAction("page_action_empty_popup.json"); | 164 action = LoadAction("page_action_empty_popup.json"); |
| 166 | 165 |
| 167 ASSERT_TRUE(action); | 166 ASSERT_TRUE(action); |
| 168 EXPECT_TRUE(action->default_popup_url.is_empty()); | 167 EXPECT_TRUE(action->default_popup_url.is_empty()); |
| 169 ASSERT_STREQ( | 168 ASSERT_STREQ( |
| 170 "", | 169 "", |
| 171 action->default_popup_url.spec().c_str()); | 170 action->default_popup_url.spec().c_str()); |
| 172 } | 171 } |
| 173 | 172 |
| 174 } // namespace extensions | 173 } // namespace extensions |
| OLD | NEW |