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

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

Issue 10911300: Move ExtensionAction from common/ to browser/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: proof of concept Created 8 years, 3 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/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.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/string_number_conversions.h" 13 #include "base/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/command.h" 16 #include "chrome/common/extensions/command.h"
17 #include "chrome/common/extensions/extension_action.h"
18 #include "chrome/common/extensions/extension_error_utils.h" 17 #include "chrome/common/extensions/extension_error_utils.h"
19 #include "chrome/common/extensions/extension_file_util.h" 18 #include "chrome/common/extensions/extension_file_util.h"
20 #include "chrome/common/extensions/extension_manifest_constants.h" 19 #include "chrome/common/extensions/extension_manifest_constants.h"
21 #include "chrome/common/extensions/extension_resource.h" 20 #include "chrome/common/extensions/extension_resource.h"
22 #include "chrome/common/extensions/features/feature.h" 21 #include "chrome/common/extensions/features/feature.h"
23 #include "chrome/common/extensions/permissions/api_permission.h" 22 #include "chrome/common/extensions/permissions/api_permission.h"
24 #include "chrome/common/extensions/permissions/permission_set.h" 23 #include "chrome/common/extensions/permissions/permission_set.h"
25 #include "chrome/common/extensions/permissions/socket_permission.h" 24 #include "chrome/common/extensions/permissions/socket_permission.h"
26 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
27 #include "googleurl/src/gurl.h" 26 #include "googleurl/src/gurl.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 const std::string& test_file) { 99 const std::string& test_file) {
101 return LoadManifest(dir, test_file, Extension::NO_FLAGS); 100 return LoadManifest(dir, test_file, Extension::NO_FLAGS);
102 } 101 }
103 102
104 static scoped_refptr<Extension> LoadManifestStrict( 103 static scoped_refptr<Extension> LoadManifestStrict(
105 const std::string& dir, 104 const std::string& dir,
106 const std::string& test_file) { 105 const std::string& test_file) {
107 return LoadManifest(dir, test_file, Extension::NO_FLAGS); 106 return LoadManifest(dir, test_file, Extension::NO_FLAGS);
108 } 107 }
109 108
110 static scoped_ptr<ExtensionAction> LoadAction(const std::string& manifest) { 109 static Extension::ActionInfo LoadAction(const std::string& manifest) {
111 scoped_refptr<Extension> extension = LoadManifest("page_action", 110 scoped_refptr<Extension> extension = LoadManifest("page_action",
112 manifest); 111 manifest);
113 return extension->page_action()->CopyForTest(); 112 return *extension->page_action();
114 } 113 }
115 114
116 static void LoadActionAndExpectError(const std::string& manifest, 115 static void LoadActionAndExpectError(const std::string& manifest,
117 const std::string& expected_error) { 116 const std::string& expected_error) {
118 std::string error; 117 std::string error;
119 scoped_refptr<Extension> extension = LoadManifestUnchecked("page_action", 118 scoped_refptr<Extension> extension = LoadManifestUnchecked("page_action",
120 manifest, Extension::INTERNAL, Extension::NO_FLAGS, &error); 119 manifest, Extension::INTERNAL, Extension::NO_FLAGS, &error);
121 EXPECT_FALSE(extension); 120 EXPECT_FALSE(extension);
122 EXPECT_EQ(expected_error, error); 121 EXPECT_EQ(expected_error, error);
123 } 122 }
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 1207
1209 TEST(ExtensionTest, GetSyncTypeExtensionWithTwoPlugins) { 1208 TEST(ExtensionTest, GetSyncTypeExtensionWithTwoPlugins) {
1210 scoped_refptr<Extension> extension( 1209 scoped_refptr<Extension> extension(
1211 MakeSyncTestExtension(EXTENSION, GURL(), GURL(), 1210 MakeSyncTestExtension(EXTENSION, GURL(), GURL(),
1212 Extension::INTERNAL, 2, FilePath(), 1211 Extension::INTERNAL, 2, FilePath(),
1213 Extension::NO_FLAGS)); 1212 Extension::NO_FLAGS));
1214 if (extension) 1213 if (extension)
1215 EXPECT_EQ(extension->GetSyncType(), Extension::SYNC_TYPE_NONE); 1214 EXPECT_EQ(extension->GetSyncType(), Extension::SYNC_TYPE_NONE);
1216 } 1215 }
1217 #endif // !defined(OS_CHROMEOS) 1216 #endif // !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698