Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: chrome/browser/media_galleries/media_galleries_test_util.cc

Issue 22794012: Rename extension_manifest_keys namespace to extensions::manifest_keys. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "chrome/browser/extensions/extension_prefs.h" 12 #include "chrome/browser/extensions/extension_prefs.h"
13 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/extension_system.h" 14 #include "chrome/browser/extensions/extension_system.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
17 #include "chrome/common/extensions/extension.h" 17 #include "chrome/common/extensions/extension.h"
18 #include "chrome/common/extensions/extension_manifest_constants.h" 18 #include "extensions/common/manifest_constants.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 namespace chrome { 21 namespace chrome {
22 22
23 scoped_refptr<extensions::Extension> AddMediaGalleriesApp( 23 scoped_refptr<extensions::Extension> AddMediaGalleriesApp(
24 const std::string& name, 24 const std::string& name,
25 const std::vector<std::string>& media_galleries_permissions, 25 const std::vector<std::string>& media_galleries_permissions,
26 Profile* profile) { 26 Profile* profile) {
27 scoped_ptr<DictionaryValue> manifest(new DictionaryValue); 27 scoped_ptr<DictionaryValue> manifest(new DictionaryValue);
28 manifest->SetString(extension_manifest_keys::kName, name); 28 manifest->SetString(extensions::manifest_keys::kName, name);
29 manifest->SetString(extension_manifest_keys::kVersion, "0.1"); 29 manifest->SetString(extensions::manifest_keys::kVersion, "0.1");
30 manifest->SetInteger(extension_manifest_keys::kManifestVersion, 2); 30 manifest->SetInteger(extensions::manifest_keys::kManifestVersion, 2);
31 ListValue* background_script_list = new ListValue; 31 ListValue* background_script_list = new ListValue;
32 background_script_list->Append(Value::CreateStringValue("background.js")); 32 background_script_list->Append(Value::CreateStringValue("background.js"));
33 manifest->Set(extension_manifest_keys::kPlatformAppBackgroundScripts, 33 manifest->Set(extensions::manifest_keys::kPlatformAppBackgroundScripts,
34 background_script_list); 34 background_script_list);
35 35
36 ListValue* permission_detail_list = new ListValue; 36 ListValue* permission_detail_list = new ListValue;
37 for (size_t i = 0; i < media_galleries_permissions.size(); i++) 37 for (size_t i = 0; i < media_galleries_permissions.size(); i++)
38 permission_detail_list->Append( 38 permission_detail_list->Append(
39 Value::CreateStringValue(media_galleries_permissions[i])); 39 Value::CreateStringValue(media_galleries_permissions[i]));
40 DictionaryValue* media_galleries_permission = new DictionaryValue(); 40 DictionaryValue* media_galleries_permission = new DictionaryValue();
41 media_galleries_permission->Set("mediaGalleries", permission_detail_list); 41 media_galleries_permission->Set("mediaGalleries", permission_detail_list);
42 ListValue* permission_list = new ListValue; 42 ListValue* permission_list = new ListValue;
43 permission_list->Append(media_galleries_permission); 43 permission_list->Append(media_galleries_permission);
44 manifest->Set(extension_manifest_keys::kPermissions, permission_list); 44 manifest->Set(extensions::manifest_keys::kPermissions, permission_list);
45 45
46 extensions::ExtensionPrefs* extension_prefs = 46 extensions::ExtensionPrefs* extension_prefs =
47 extensions::ExtensionPrefs::Get(profile); 47 extensions::ExtensionPrefs::Get(profile);
48 base::FilePath path = extension_prefs->install_directory().AppendASCII(name); 48 base::FilePath path = extension_prefs->install_directory().AppendASCII(name);
49 std::string errors; 49 std::string errors;
50 scoped_refptr<extensions::Extension> extension = 50 scoped_refptr<extensions::Extension> extension =
51 extensions::Extension::Create(path, extensions::Manifest::INTERNAL, 51 extensions::Extension::Create(path, extensions::Manifest::INTERNAL,
52 *manifest.get(), 52 *manifest.get(),
53 extensions::Extension::NO_FLAGS, &errors); 53 extensions::Extension::NO_FLAGS, &errors);
54 EXPECT_TRUE(extension.get() != NULL) << errors; 54 EXPECT_TRUE(extension.get() != NULL) << errors;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 chrome::DIR_USER_MUSIC, fake_dir_.path().AppendASCII("music"))); 95 chrome::DIR_USER_MUSIC, fake_dir_.path().AppendASCII("music")));
96 pictures_override_.reset(new base::ScopedPathOverride( 96 pictures_override_.reset(new base::ScopedPathOverride(
97 chrome::DIR_USER_PICTURES, fake_dir_.path().AppendASCII("pictures"))); 97 chrome::DIR_USER_PICTURES, fake_dir_.path().AppendASCII("pictures")));
98 video_override_.reset(new base::ScopedPathOverride( 98 video_override_.reset(new base::ScopedPathOverride(
99 chrome::DIR_USER_VIDEOS, fake_dir_.path().AppendASCII("videos"))); 99 chrome::DIR_USER_VIDEOS, fake_dir_.path().AppendASCII("videos")));
100 num_galleries_ = 3; 100 num_galleries_ = 3;
101 #endif 101 #endif
102 } 102 }
103 103
104 } // namespace chrome 104 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/extensions/webstore_installer.cc ('k') | chrome/browser/profile_resetter/profile_resetter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698