Chromium Code Reviews| 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) { |
|
sky
2016/09/14 17:46:42
optional: while here remove {}
Adam Rice
2016/09/15 02:05:55
Done.
| |
| 42 return base::WrapUnique(new ActionInfo(*page_action_info)); | 42 return base::MakeUnique<ActionInfo>(*page_action_info); |
| 43 } | 43 } |
| 44 ADD_FAILURE() << "Expected manifest in " << manifest_filename | 44 ADD_FAILURE() << "Expected manifest in " << manifest_filename |
| 45 << " to include a page_action section."; | 45 << " to include a page_action section."; |
| 46 return std::unique_ptr<ActionInfo>(); | 46 return std::unique_ptr<ActionInfo>(); |
|
sky
2016/09/14 17:46:43
return nullptr?
Adam Rice
2016/09/15 02:05:55
Done.
| |
| 47 } | 47 } |
| 48 | 48 |
| 49 TEST_F(PageActionManifestTest, ManifestVersion2) { | 49 TEST_F(PageActionManifestTest, ManifestVersion2) { |
| 50 scoped_refptr<Extension> extension( | 50 scoped_refptr<Extension> extension( |
| 51 LoadAndExpectSuccess("page_action_manifest_version_2.json")); | 51 LoadAndExpectSuccess("page_action_manifest_version_2.json")); |
| 52 ASSERT_TRUE(extension.get()); | 52 ASSERT_TRUE(extension.get()); |
| 53 const ActionInfo* page_action_info = | 53 const ActionInfo* page_action_info = |
| 54 ActionInfo::GetPageActionInfo(extension.get()); | 54 ActionInfo::GetPageActionInfo(extension.get()); |
| 55 ASSERT_TRUE(page_action_info); | 55 ASSERT_TRUE(page_action_info); |
| 56 | 56 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 action = LoadAction("page_action_empty_popup.json"); | 165 action = LoadAction("page_action_empty_popup.json"); |
| 166 | 166 |
| 167 ASSERT_TRUE(action); | 167 ASSERT_TRUE(action); |
| 168 EXPECT_TRUE(action->default_popup_url.is_empty()); | 168 EXPECT_TRUE(action->default_popup_url.is_empty()); |
| 169 ASSERT_STREQ( | 169 ASSERT_STREQ( |
| 170 "", | 170 "", |
| 171 action->default_popup_url.spec().c_str()); | 171 action->default_popup_url.spec().c_str()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace extensions | 174 } // namespace extensions |
| OLD | NEW |