| 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 "chrome/browser/extensions/component_loader.h" | 5 #include "chrome/browser/extensions/component_loader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 std::string manifest_contents_; | 124 std::string manifest_contents_; |
| 125 | 125 |
| 126 base::FilePath GetBasePath() { | 126 base::FilePath GetBasePath() { |
| 127 base::FilePath test_data_dir; | 127 base::FilePath test_data_dir; |
| 128 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); | 128 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); |
| 129 return test_data_dir.AppendASCII("extensions"); | 129 return test_data_dir.AppendASCII("extensions"); |
| 130 } | 130 } |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 TEST_F(ComponentLoaderTest, ParseManifest) { | 133 TEST_F(ComponentLoaderTest, ParseManifest) { |
| 134 scoped_ptr<base::DictionaryValue> manifest; | 134 std::unique_ptr<base::DictionaryValue> manifest; |
| 135 | 135 |
| 136 // Test invalid JSON. | 136 // Test invalid JSON. |
| 137 manifest.reset( | 137 manifest.reset( |
| 138 component_loader_.ParseManifest("{ 'test': 3 } invalid")); | 138 component_loader_.ParseManifest("{ 'test': 3 } invalid")); |
| 139 EXPECT_FALSE(manifest.get()); | 139 EXPECT_FALSE(manifest.get()); |
| 140 | 140 |
| 141 // Test manifests that are valid JSON, but don't have an object literal | 141 // Test manifests that are valid JSON, but don't have an object literal |
| 142 // at the root. ParseManifest() should always return NULL. | 142 // at the root. ParseManifest() should always return NULL. |
| 143 | 143 |
| 144 manifest.reset(component_loader_.ParseManifest(std::string())); | 144 manifest.reset(component_loader_.ParseManifest(std::string())); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 component_loader_.AddOrReplace(known_extension); | 279 component_loader_.AddOrReplace(known_extension); |
| 280 EXPECT_EQ(default_count + 1, registry->enabled_extensions().size()); | 280 EXPECT_EQ(default_count + 1, registry->enabled_extensions().size()); |
| 281 EXPECT_EQ(1u, extension_service_.unloaded_count()); | 281 EXPECT_EQ(1u, extension_service_.unloaded_count()); |
| 282 | 282 |
| 283 // Add an invalid component extension. | 283 // Add an invalid component extension. |
| 284 std::string extension_id = component_loader_.AddOrReplace(invalid_extension); | 284 std::string extension_id = component_loader_.AddOrReplace(invalid_extension); |
| 285 EXPECT_TRUE(extension_id.empty()); | 285 EXPECT_TRUE(extension_id.empty()); |
| 286 } | 286 } |
| 287 | 287 |
| 288 } // namespace extensions | 288 } // namespace extensions |
| OLD | NEW |