| 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 "chrome/browser/media_galleries/media_galleries_test_util.h" | 5 #include "chrome/browser/media_galleries/media_galleries_test_util.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 scoped_refptr<extensions::Extension> AddMediaGalleriesApp( | 38 scoped_refptr<extensions::Extension> AddMediaGalleriesApp( |
| 39 const std::string& name, | 39 const std::string& name, |
| 40 const std::vector<std::string>& media_galleries_permissions, | 40 const std::vector<std::string>& media_galleries_permissions, |
| 41 Profile* profile) { | 41 Profile* profile) { |
| 42 scoped_ptr<base::DictionaryValue> manifest(new base::DictionaryValue); | 42 scoped_ptr<base::DictionaryValue> manifest(new base::DictionaryValue); |
| 43 manifest->SetString(extensions::manifest_keys::kName, name); | 43 manifest->SetString(extensions::manifest_keys::kName, name); |
| 44 manifest->SetString(extensions::manifest_keys::kVersion, "0.1"); | 44 manifest->SetString(extensions::manifest_keys::kVersion, "0.1"); |
| 45 manifest->SetInteger(extensions::manifest_keys::kManifestVersion, 2); | 45 manifest->SetInteger(extensions::manifest_keys::kManifestVersion, 2); |
| 46 base::ListValue* background_script_list = new base::ListValue; | 46 base::ListValue* background_script_list = new base::ListValue; |
| 47 background_script_list->Append( | 47 background_script_list->Append(new base::StringValue("background.js")); |
| 48 base::Value::CreateStringValue("background.js")); | |
| 49 manifest->Set(extensions::manifest_keys::kPlatformAppBackgroundScripts, | 48 manifest->Set(extensions::manifest_keys::kPlatformAppBackgroundScripts, |
| 50 background_script_list); | 49 background_script_list); |
| 51 | 50 |
| 52 base::ListValue* permission_detail_list = new base::ListValue; | 51 base::ListValue* permission_detail_list = new base::ListValue; |
| 53 for (size_t i = 0; i < media_galleries_permissions.size(); i++) | 52 for (size_t i = 0; i < media_galleries_permissions.size(); i++) |
| 54 permission_detail_list->Append( | 53 permission_detail_list->Append( |
| 55 base::Value::CreateStringValue(media_galleries_permissions[i])); | 54 new base::StringValue(media_galleries_permissions[i])); |
| 56 base::DictionaryValue* media_galleries_permission = | 55 base::DictionaryValue* media_galleries_permission = |
| 57 new base::DictionaryValue(); | 56 new base::DictionaryValue(); |
| 58 media_galleries_permission->Set("mediaGalleries", permission_detail_list); | 57 media_galleries_permission->Set("mediaGalleries", permission_detail_list); |
| 59 base::ListValue* permission_list = new base::ListValue; | 58 base::ListValue* permission_list = new base::ListValue; |
| 60 permission_list->Append(media_galleries_permission); | 59 permission_list->Append(media_galleries_permission); |
| 61 manifest->Set(extensions::manifest_keys::kPermissions, permission_list); | 60 manifest->Set(extensions::manifest_keys::kPermissions, permission_list); |
| 62 | 61 |
| 63 extensions::ExtensionPrefs* extension_prefs = | 62 extensions::ExtensionPrefs* extension_prefs = |
| 64 extensions::ExtensionPrefs::Get(profile); | 63 extensions::ExtensionPrefs::Get(profile); |
| 65 base::FilePath path = extension_prefs->install_directory().AppendASCII(name); | 64 base::FilePath path = extension_prefs->install_directory().AppendASCII(name); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 203 |
| 205 base::FilePath MakeMediaGalleriesTestingPath(const std::string& dir) { | 204 base::FilePath MakeMediaGalleriesTestingPath(const std::string& dir) { |
| 206 #if defined(OS_WIN) | 205 #if defined(OS_WIN) |
| 207 return base::FilePath(FILE_PATH_LITERAL("C:\\")).AppendASCII(dir); | 206 return base::FilePath(FILE_PATH_LITERAL("C:\\")).AppendASCII(dir); |
| 208 #elif defined(OS_POSIX) | 207 #elif defined(OS_POSIX) |
| 209 return base::FilePath(FILE_PATH_LITERAL("/")).Append(dir); | 208 return base::FilePath(FILE_PATH_LITERAL("/")).Append(dir); |
| 210 #else | 209 #else |
| 211 NOTREACHED(); | 210 NOTREACHED(); |
| 212 #endif | 211 #endif |
| 213 } | 212 } |
| OLD | NEW |