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 <memory> |
5 #include <utility> | 6 #include <utility> |
6 | 7 |
7 #include "base/macros.h" | 8 #include "base/macros.h" |
8 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
9 #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handle
r.h" | 10 #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handle
r.h" |
10 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" | 11 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" |
11 #include "extensions/common/constants.h" | 12 #include "extensions/common/constants.h" |
12 #include "extensions/common/error_utils.h" | 13 #include "extensions/common/error_utils.h" |
13 #include "extensions/common/extension_builder.h" | 14 #include "extensions/common/extension_builder.h" |
14 #include "extensions/common/manifest_constants.h" | 15 #include "extensions/common/manifest_constants.h" |
(...skipping 25 matching lines...) Expand all Loading... |
40 extensions::ListBuilder() | 41 extensions::ListBuilder() |
41 .Append(extensions::DictionaryBuilder() | 42 .Append(extensions::DictionaryBuilder() |
42 .Set("id", "open") | 43 .Set("id", "open") |
43 .Set("default_title", "open") | 44 .Set("default_title", "open") |
44 .Set("file_filters", extensions::ListBuilder() | 45 .Set("file_filters", extensions::ListBuilder() |
45 .Append("filesystem:*.txt") | 46 .Append("filesystem:*.txt") |
46 .Append("filesystem:*.html") | 47 .Append("filesystem:*.html") |
47 .Build()) | 48 .Build()) |
48 .Build()) | 49 .Build()) |
49 .Build()); | 50 .Build()); |
50 scoped_ptr<base::DictionaryValue> bad_manifest_value( | 51 std::unique_ptr<base::DictionaryValue> bad_manifest_value( |
51 bad_manifest_builder.Build()); | 52 bad_manifest_builder.Build()); |
52 | 53 |
53 // Create a good manifest by extending the bad one with the missing | 54 // Create a good manifest by extending the bad one with the missing |
54 // permission. | 55 // permission. |
55 extensions::DictionaryBuilder good_manifest_builder(*bad_manifest_value); | 56 extensions::DictionaryBuilder good_manifest_builder(*bad_manifest_value); |
56 good_manifest_builder.Set( | 57 good_manifest_builder.Set( |
57 "permissions", | 58 "permissions", |
58 extensions::ListBuilder().Append("fileBrowserHandler").Build()); | 59 extensions::ListBuilder().Append("fileBrowserHandler").Build()); |
59 | 60 |
60 extensions::ExtensionBuilder bad_app_builder; | 61 extensions::ExtensionBuilder bad_app_builder; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 const FileBrowserHandler* action = handlers->at(0).get(); | 224 const FileBrowserHandler* action = handlers->at(0).get(); |
224 const extensions::URLPatternSet& patterns = action->file_url_patterns(); | 225 const extensions::URLPatternSet& patterns = action->file_url_patterns(); |
225 | 226 |
226 EXPECT_EQ(0U, patterns.patterns().size()); | 227 EXPECT_EQ(0U, patterns.patterns().size()); |
227 EXPECT_TRUE(action->HasCreateAccessPermission()); | 228 EXPECT_TRUE(action->HasCreateAccessPermission()); |
228 EXPECT_FALSE(action->CanRead()); | 229 EXPECT_FALSE(action->CanRead()); |
229 EXPECT_FALSE(action->CanWrite()); | 230 EXPECT_FALSE(action->CanWrite()); |
230 } | 231 } |
231 | 232 |
232 } // namespace | 233 } // namespace |
OLD | NEW |