OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 scoped_refptr<Extension> LoadExtensionWithLocation( | 43 scoped_refptr<Extension> LoadExtensionWithLocation( |
44 DictionaryValue* value, | 44 DictionaryValue* value, |
45 Extension::Location location, | 45 Extension::Location location, |
46 bool strict_error_checks, | 46 bool strict_error_checks, |
47 std::string* error) { | 47 std::string* error) { |
48 FilePath path; | 48 FilePath path; |
49 PathService::Get(chrome::DIR_TEST_DATA, &path); | 49 PathService::Get(chrome::DIR_TEST_DATA, &path); |
50 path = path.AppendASCII("extensions").AppendASCII("manifest_tests"); | 50 path = path.AppendASCII("extensions").AppendASCII("manifest_tests"); |
51 return Extension::Create(path.DirName(), location, *value, false, | 51 int flags = Extension::NO_FLAGS; |
52 strict_error_checks, error); | 52 if (strict_error_checks) |
| 53 flags |= Extension::STRICT_ERROR_CHECKS; |
| 54 return Extension::Create(path.DirName(), location, *value, flags, error); |
53 } | 55 } |
54 | 56 |
55 scoped_refptr<Extension> LoadExtension(const std::string& name, | 57 scoped_refptr<Extension> LoadExtension(const std::string& name, |
56 std::string* error) { | 58 std::string* error) { |
57 return LoadExtensionWithLocation(name, Extension::INTERNAL, false, error); | 59 return LoadExtensionWithLocation(name, Extension::INTERNAL, false, error); |
58 } | 60 } |
59 | 61 |
60 scoped_refptr<Extension> LoadExtensionStrict(const std::string& name, | 62 scoped_refptr<Extension> LoadExtensionStrict(const std::string& name, |
61 std::string* error) { | 63 std::string* error) { |
62 return LoadExtensionWithLocation(name, Extension::INTERNAL, true, error); | 64 return LoadExtensionWithLocation(name, Extension::INTERNAL, true, error); |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 EXPECT_FALSE(extension->is_storage_isolated()); | 557 EXPECT_FALSE(extension->is_storage_isolated()); |
556 | 558 |
557 CommandLine old_command_line = *CommandLine::ForCurrentProcess(); | 559 CommandLine old_command_line = *CommandLine::ForCurrentProcess(); |
558 CommandLine::ForCurrentProcess()->AppendSwitch( | 560 CommandLine::ForCurrentProcess()->AppendSwitch( |
559 switches::kEnableExperimentalAppManifests); | 561 switches::kEnableExperimentalAppManifests); |
560 scoped_refptr<Extension> extension2( | 562 scoped_refptr<Extension> extension2( |
561 LoadAndExpectSuccess("isolated_app_valid.json")); | 563 LoadAndExpectSuccess("isolated_app_valid.json")); |
562 EXPECT_TRUE(extension2->is_storage_isolated()); | 564 EXPECT_TRUE(extension2->is_storage_isolated()); |
563 *CommandLine::ForCurrentProcess() = old_command_line; | 565 *CommandLine::ForCurrentProcess() = old_command_line; |
564 } | 566 } |
OLD | NEW |