OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 EXPECT_TRUE(file_util::PathExists(path)); | 37 EXPECT_TRUE(file_util::PathExists(path)); |
38 | 38 |
39 JSONFileValueSerializer serializer(path); | 39 JSONFileValueSerializer serializer(path); |
40 scoped_ptr<DictionaryValue> value( | 40 scoped_ptr<DictionaryValue> value( |
41 static_cast<DictionaryValue*>(serializer.Deserialize(NULL, error))); | 41 static_cast<DictionaryValue*>(serializer.Deserialize(NULL, error))); |
42 if (!value.get()) | 42 if (!value.get()) |
43 return NULL; | 43 return NULL; |
44 | 44 |
45 scoped_ptr<Extension> extension(new Extension(path.DirName())); | 45 scoped_ptr<Extension> extension(new Extension(path.DirName())); |
46 extension->set_location(location); | 46 extension->set_location(location); |
47 if (enable_apps_) | 47 extension->set_apps_enabled(enable_apps_); |
48 extension->set_apps_enabled(true); | |
49 | 48 |
50 if (!extension->InitFromValue(*value, false, error)) | 49 if (!extension->InitFromValue(*value, false, error)) |
51 return NULL; | 50 return NULL; |
52 | 51 |
53 return extension.release(); | 52 return extension.release(); |
54 } | 53 } |
55 | 54 |
56 Extension* LoadAndExpectSuccess(const std::string& name) { | 55 Extension* LoadAndExpectSuccess(const std::string& name) { |
57 std::string error; | 56 std::string error; |
58 Extension* extension = LoadExtension(name, &error); | 57 Extension* extension = LoadExtension(name, &error); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 "permission_chrome_resources_url.json", | 212 "permission_chrome_resources_url.json", |
214 Extension::COMPONENT, | 213 Extension::COMPONENT, |
215 &error)); | 214 &error)); |
216 EXPECT_EQ("", error); | 215 EXPECT_EQ("", error); |
217 } | 216 } |
218 | 217 |
219 TEST_F(ManifestTest, ChromeURLContentScriptInvalid) { | 218 TEST_F(ManifestTest, ChromeURLContentScriptInvalid) { |
220 LoadAndExpectError("content_script_chrome_url_invalid.json", | 219 LoadAndExpectError("content_script_chrome_url_invalid.json", |
221 errors::kInvalidMatch); | 220 errors::kInvalidMatch); |
222 } | 221 } |
OLD | NEW |