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

Side by Side Diff: chrome/common/extensions/extension_unittest.cc

Issue 12253022: Manifest handler for all keys background-related. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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/common/extensions/extension.h" 5 #include "chrome/common/extensions/extension.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/json/json_file_value_serializer.h" 10 #include "base/json/json_file_value_serializer.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/common/chrome_paths.h" 15 #include "chrome/common/chrome_paths.h"
16 #include "chrome/common/extensions/api/commands/commands_handler.h" 16 #include "chrome/common/extensions/api/commands/commands_handler.h"
17 #include "chrome/common/extensions/api/commands/commands_handler.h"
18 #include "chrome/common/extensions/background_info.h"
17 #include "chrome/common/extensions/command.h" 19 #include "chrome/common/extensions/command.h"
18 #include "chrome/common/extensions/extension_file_util.h" 20 #include "chrome/common/extensions/extension_file_util.h"
19 #include "chrome/common/extensions/extension_manifest_constants.h" 21 #include "chrome/common/extensions/extension_manifest_constants.h"
20 #include "chrome/common/extensions/extension_resource.h" 22 #include "chrome/common/extensions/extension_resource.h"
21 #include "chrome/common/extensions/features/feature.h" 23 #include "chrome/common/extensions/features/feature.h"
22 #include "chrome/common/extensions/manifest.h" 24 #include "chrome/common/extensions/manifest.h"
23 #include "chrome/common/extensions/manifest_handler.h" 25 #include "chrome/common/extensions/manifest_handler.h"
24 #include "chrome/common/extensions/permissions/api_permission.h" 26 #include "chrome/common/extensions/permissions/api_permission.h"
25 #include "chrome/common/extensions/permissions/permission_set.h" 27 #include "chrome/common/extensions/permissions/permission_set.h"
26 #include "chrome/common/extensions/permissions/socket_permission.h" 28 #include "chrome/common/extensions/permissions/socket_permission.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 const std::string& dir, 96 const std::string& dir,
95 const std::string& test_file) { 97 const std::string& test_file) {
96 return LoadManifest(dir, test_file, Extension::NO_FLAGS); 98 return LoadManifest(dir, test_file, Extension::NO_FLAGS);
97 } 99 }
98 100
99 } // namespace 101 } // namespace
100 102
101 class ExtensionTest : public testing::Test { 103 class ExtensionTest : public testing::Test {
102 protected: 104 protected:
103 virtual void SetUp() OVERRIDE { 105 virtual void SetUp() OVERRIDE {
104 ManifestHandler::Register(extension_manifest_keys::kCommands, 106 (new BackgroundManifestHandler)->Register();
105 make_linked_ptr(new CommandsHandler)); 107 (new CommandsHandler)->Register();
108 }
109
110 virtual void TearDown() OVERRIDE {
111 ManifestHandler::ClearRegistryForTesting();
106 } 112 }
107 }; 113 };
108 114
109 // We persist location values in the preferences, so this is a sanity test that 115 // We persist location values in the preferences, so this is a sanity test that
110 // someone doesn't accidentally change them. 116 // someone doesn't accidentally change them.
111 TEST_F(ExtensionTest, LocationValuesTest) { 117 TEST_F(ExtensionTest, LocationValuesTest) {
112 ASSERT_EQ(0, Manifest::INVALID_LOCATION); 118 ASSERT_EQ(0, Manifest::INVALID_LOCATION);
113 ASSERT_EQ(1, Manifest::INTERNAL); 119 ASSERT_EQ(1, Manifest::INTERNAL);
114 ASSERT_EQ(2, Manifest::EXTERNAL_PREF); 120 ASSERT_EQ(2, Manifest::EXTERNAL_PREF);
115 ASSERT_EQ(3, Manifest::EXTERNAL_REGISTRY); 121 ASSERT_EQ(3, Manifest::EXTERNAL_REGISTRY);
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 scoped_refptr<Extension> extension( 1086 scoped_refptr<Extension> extension(
1081 MakeSyncTestExtension(EXTENSION, GURL(), GURL(), 1087 MakeSyncTestExtension(EXTENSION, GURL(), GURL(),
1082 Manifest::INTERNAL, 2, base::FilePath(), 1088 Manifest::INTERNAL, 2, base::FilePath(),
1083 Extension::NO_FLAGS)); 1089 Extension::NO_FLAGS));
1084 if (extension) 1090 if (extension)
1085 EXPECT_EQ(extension->GetSyncType(), Extension::SYNC_TYPE_NONE); 1091 EXPECT_EQ(extension->GetSyncType(), Extension::SYNC_TYPE_NONE);
1086 } 1092 }
1087 #endif // !defined(OS_CHROMEOS) 1093 #endif // !defined(OS_CHROMEOS)
1088 1094
1089 } // namespace extensions 1095 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_file_util_unittest.cc ('k') | chrome/common/extensions/manifest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698