OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/manifest_handlers/settings_overrides_handler.
h" | 5 #include "chrome/common/extensions/manifest_handlers/settings_overrides_handler.
h" |
6 | 6 |
7 #include "base/json/json_string_value_serializer.h" | 7 #include "base/json/json_string_value_serializer.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/common/extensions/features/feature_channel.h" | 9 #include "chrome/common/extensions/features/feature_channel.h" |
10 #include "chrome/common/extensions/manifest_url_handler.h" | 10 #include "chrome/common/extensions/manifest_url_handler.h" |
| 11 #include "extensions/common/error_utils.h" |
11 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
12 #include "extensions/common/manifest_constants.h" | 13 #include "extensions/common/manifest_constants.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 const char kManifest[] = "{" | 18 const char kManifest[] = "{" |
18 " \"version\" : \"1.0.0.0\"," | 19 " \"version\" : \"1.0.0.0\"," |
19 " \"name\" : \"Test\"," | 20 " \"name\" : \"Test\"," |
20 " \"chrome_settings_overrides\" : {" | 21 " \"chrome_settings_overrides\" : {" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY)); | 114 ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY)); |
114 scoped_refptr<Extension> extension = Extension::Create( | 115 scoped_refptr<Extension> extension = Extension::Create( |
115 base::FilePath(FILE_PATH_LITERAL("//nonexistent")), | 116 base::FilePath(FILE_PATH_LITERAL("//nonexistent")), |
116 Manifest::INVALID_LOCATION, | 117 Manifest::INVALID_LOCATION, |
117 *static_cast<base::DictionaryValue*>(root.get()), | 118 *static_cast<base::DictionaryValue*>(root.get()), |
118 Extension::NO_FLAGS, | 119 Extension::NO_FLAGS, |
119 &error); | 120 &error); |
120 #if defined(OS_WIN) | 121 #if defined(OS_WIN) |
121 EXPECT_FALSE(extension); | 122 EXPECT_FALSE(extension); |
122 EXPECT_EQ( | 123 EXPECT_EQ( |
123 std::string(extensions::manifest_errors::kInvalidEmptySettingsOverrides), | 124 extensions::ErrorUtils::FormatErrorMessage( |
| 125 extensions::manifest_errors::kInvalidEmptyDictionary, |
| 126 extensions::manifest_keys::kSettingsOverride), |
124 error); | 127 error); |
125 #else | 128 #else |
126 EXPECT_TRUE(extension); | 129 EXPECT_TRUE(extension); |
127 EXPECT_FALSE( | 130 EXPECT_FALSE( |
128 extension->manifest()->HasPath(manifest_keys::kSettingsOverride)); | 131 extension->manifest()->HasPath(manifest_keys::kSettingsOverride)); |
129 #endif | 132 #endif |
130 } | 133 } |
131 | 134 |
132 } // namespace | 135 } // namespace |
OLD | NEW |