| 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 "extensions/browser/api/storage/settings_test_util.h" | 5 #include "extensions/browser/api/storage/settings_test_util.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/ptr_util.h" |
| 8 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/values.h" |
| 9 #include "extensions/browser/api/storage/storage_frontend.h" | 13 #include "extensions/browser/api/storage/storage_frontend.h" |
| 10 #include "extensions/browser/extension_registry.h" | 14 #include "extensions/browser/extension_registry.h" |
| 11 #include "extensions/browser/extension_system_provider.h" | 15 #include "extensions/browser/extension_system_provider.h" |
| 12 #include "extensions/browser/extensions_browser_client.h" | 16 #include "extensions/browser/extensions_browser_client.h" |
| 13 #include "extensions/common/extension.h" | 17 #include "extensions/common/extension.h" |
| 14 #include "extensions/common/permissions/permissions_data.h" | 18 #include "extensions/common/permissions/permissions_data.h" |
| 15 | 19 |
| 16 namespace extensions { | 20 namespace extensions { |
| 17 | 21 |
| 18 namespace settings_test_util { | 22 namespace settings_test_util { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 const std::set<std::string>& permissions_set) { | 74 const std::set<std::string>& permissions_set) { |
| 71 base::DictionaryValue manifest; | 75 base::DictionaryValue manifest; |
| 72 manifest.SetString("name", std::string("Test extension ") + id); | 76 manifest.SetString("name", std::string("Test extension ") + id); |
| 73 manifest.SetString("version", "1.0"); | 77 manifest.SetString("version", "1.0"); |
| 74 | 78 |
| 75 std::unique_ptr<base::ListValue> permissions(new base::ListValue()); | 79 std::unique_ptr<base::ListValue> permissions(new base::ListValue()); |
| 76 for (std::set<std::string>::const_iterator it = permissions_set.begin(); | 80 for (std::set<std::string>::const_iterator it = permissions_set.begin(); |
| 77 it != permissions_set.end(); ++it) { | 81 it != permissions_set.end(); ++it) { |
| 78 permissions->AppendString(*it); | 82 permissions->AppendString(*it); |
| 79 } | 83 } |
| 80 manifest.Set("permissions", permissions.release()); | 84 manifest.Set("permissions", std::move(permissions)); |
| 81 | 85 |
| 82 switch (type) { | 86 switch (type) { |
| 83 case Manifest::TYPE_EXTENSION: | 87 case Manifest::TYPE_EXTENSION: |
| 84 break; | 88 break; |
| 85 | 89 |
| 86 case Manifest::TYPE_LEGACY_PACKAGED_APP: { | 90 case Manifest::TYPE_LEGACY_PACKAGED_APP: { |
| 87 base::DictionaryValue* app = new base::DictionaryValue(); | 91 auto app = base::MakeUnique<base::DictionaryValue>(); |
| 88 base::DictionaryValue* app_launch = new base::DictionaryValue(); | 92 auto app_launch = base::MakeUnique<base::DictionaryValue>(); |
| 89 app_launch->SetString("local_path", "fake.html"); | 93 app_launch->SetString("local_path", "fake.html"); |
| 90 app->Set("launch", app_launch); | 94 app->Set("launch", std::move(app_launch)); |
| 91 manifest.Set("app", app); | 95 manifest.Set("app", std::move(app)); |
| 92 break; | 96 break; |
| 93 } | 97 } |
| 94 | 98 |
| 95 default: | 99 default: |
| 96 NOTREACHED(); | 100 NOTREACHED(); |
| 97 } | 101 } |
| 98 | 102 |
| 99 std::string error; | 103 std::string error; |
| 100 scoped_refptr<const Extension> extension( | 104 scoped_refptr<const Extension> extension( |
| 101 Extension::Create(base::FilePath(), | 105 Extension::Create(base::FilePath(), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 115 it != permissions_set.end(); ++it) { | 119 it != permissions_set.end(); ++it) { |
| 116 DCHECK(extension->permissions_data()->HasAPIPermission(*it)); | 120 DCHECK(extension->permissions_data()->HasAPIPermission(*it)); |
| 117 } | 121 } |
| 118 | 122 |
| 119 return extension; | 123 return extension; |
| 120 } | 124 } |
| 121 | 125 |
| 122 } // namespace settings_test_util | 126 } // namespace settings_test_util |
| 123 | 127 |
| 124 } // namespace extensions | 128 } // namespace extensions |
| OLD | NEW |