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 "base/json/json_file_value_serializer.h" | 5 #include "base/json/json_file_value_serializer.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "chrome/browser/extensions/extension_info_map.h" | 8 #include "chrome/browser/extensions/extension_info_map.h" |
9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 static scoped_refptr<Extension> LoadManifest(const std::string& dir, | 63 static scoped_refptr<Extension> LoadManifest(const std::string& dir, |
64 const std::string& test_file) { | 64 const std::string& test_file) { |
65 base::FilePath path; | 65 base::FilePath path; |
66 PathService::Get(chrome::DIR_TEST_DATA, &path); | 66 PathService::Get(chrome::DIR_TEST_DATA, &path); |
67 path = path.AppendASCII("extensions") | 67 path = path.AppendASCII("extensions") |
68 .AppendASCII(dir) | 68 .AppendASCII(dir) |
69 .AppendASCII(test_file); | 69 .AppendASCII(test_file); |
70 | 70 |
71 JSONFileValueSerializer serializer(path); | 71 JSONFileValueSerializer serializer(path); |
72 scoped_ptr<Value> result(serializer.Deserialize(NULL, NULL)); | 72 scoped_ptr<Value> result(serializer.Deserialize(NULL, NULL)); |
73 if (!result.get()) | 73 if (!result) |
74 return NULL; | 74 return NULL; |
75 | 75 |
76 std::string error; | 76 std::string error; |
77 scoped_refptr<Extension> extension = Extension::Create( | 77 scoped_refptr<Extension> extension = Extension::Create( |
78 path, Manifest::INVALID_LOCATION, | 78 path, Manifest::INVALID_LOCATION, |
79 *static_cast<DictionaryValue*>(result.get()), | 79 *static_cast<DictionaryValue*>(result.get()), |
80 Extension::NO_FLAGS, &error); | 80 Extension::NO_FLAGS, &error); |
81 EXPECT_TRUE(extension) << error; | 81 EXPECT_TRUE(extension) << error; |
82 | 82 |
83 return extension; | 83 return extension; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 EXPECT_FALSE(match); | 176 EXPECT_FALSE(match); |
177 | 177 |
178 // Sandboxed origins should not have any permissions. | 178 // Sandboxed origins should not have any permissions. |
179 match = info_map->extensions().GetExtensionOrAppByURL(ExtensionURLInfo( | 179 match = info_map->extensions().GetExtensionOrAppByURL(ExtensionURLInfo( |
180 WebSecurityOrigin::createFromString(WebString::fromUTF8("null")), | 180 WebSecurityOrigin::createFromString(WebString::fromUTF8("null")), |
181 app_url)); | 181 app_url)); |
182 EXPECT_FALSE(match); | 182 EXPECT_FALSE(match); |
183 } | 183 } |
184 | 184 |
185 } // namespace | 185 } // namespace |
OLD | NEW |