OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 EXPECT_EQ(errors::kInvalidPrivacyBlacklists, error); | 216 EXPECT_EQ(errors::kInvalidPrivacyBlacklists, error); |
217 | 217 |
218 // Test invalid privacy blacklists list item. | 218 // Test invalid privacy blacklists list item. |
219 input_value.reset(static_cast<DictionaryValue*>(valid_value->DeepCopy())); | 219 input_value.reset(static_cast<DictionaryValue*>(valid_value->DeepCopy())); |
220 ListValue* privacy_blacklists = NULL; | 220 ListValue* privacy_blacklists = NULL; |
221 input_value->GetList(keys::kPrivacyBlacklists, &privacy_blacklists); | 221 input_value->GetList(keys::kPrivacyBlacklists, &privacy_blacklists); |
222 ASSERT_FALSE(NULL == privacy_blacklists); | 222 ASSERT_FALSE(NULL == privacy_blacklists); |
223 privacy_blacklists->Set(0, Value::CreateIntegerValue(42)); | 223 privacy_blacklists->Set(0, Value::CreateIntegerValue(42)); |
224 EXPECT_FALSE(extension.InitFromValue(*input_value, true, &error)); | 224 EXPECT_FALSE(extension.InitFromValue(*input_value, true, &error)); |
225 EXPECT_TRUE(MatchPattern(error, errors::kInvalidPrivacyBlacklistsPath)); | 225 EXPECT_TRUE(MatchPattern(error, errors::kInvalidPrivacyBlacklistsPath)); |
226 | |
227 // Test invalid default locale. | |
228 input_value.reset(static_cast<DictionaryValue*>(valid_value->DeepCopy())); | |
229 input_value->SetInteger(keys::kDefaultLocale, 42); | |
230 EXPECT_FALSE(extension.InitFromValue(*input_value, true, &error)); | |
231 EXPECT_EQ(errors::kInvalidDefaultLocale, error); | |
232 } | 226 } |
233 | 227 |
234 TEST(ExtensionTest, InitFromValueValid) { | 228 TEST(ExtensionTest, InitFromValueValid) { |
235 #if defined(OS_WIN) | 229 #if defined(OS_WIN) |
236 FilePath path(FILE_PATH_LITERAL("C:\\foo")); | 230 FilePath path(FILE_PATH_LITERAL("C:\\foo")); |
237 #elif defined(OS_POSIX) | 231 #elif defined(OS_POSIX) |
238 FilePath path(FILE_PATH_LITERAL("/foo")); | 232 FilePath path(FILE_PATH_LITERAL("/foo")); |
239 #endif | 233 #endif |
240 Extension::ResetGeneratedIdCounter(); | 234 Extension::ResetGeneratedIdCounter(); |
241 | 235 |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 scoped_ptr<Extension> new_extension( | 604 scoped_ptr<Extension> new_extension( |
611 LoadManifest("allow_silent_upgrade", | 605 LoadManifest("allow_silent_upgrade", |
612 std::string(kTests[i].base_name) + "_new.json")); | 606 std::string(kTests[i].base_name) + "_new.json")); |
613 | 607 |
614 EXPECT_EQ(kTests[i].expect_success, | 608 EXPECT_EQ(kTests[i].expect_success, |
615 Extension::IsPrivilegeIncrease(old_extension.get(), | 609 Extension::IsPrivilegeIncrease(old_extension.get(), |
616 new_extension.get())) | 610 new_extension.get())) |
617 << kTests[i].base_name; | 611 << kTests[i].base_name; |
618 } | 612 } |
619 } | 613 } |
OLD | NEW |