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 <string> | 5 #include <string> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 scoped_refptr<const Extension> CreateTestExtension( | 43 scoped_refptr<const Extension> CreateTestExtension( |
44 const std::string& id, | 44 const std::string& id, |
45 bool has_active_tab_permission, | 45 bool has_active_tab_permission, |
46 bool has_tab_capture_permission) { | 46 bool has_tab_capture_permission) { |
47 ListBuilder permissions; | 47 ListBuilder permissions; |
48 if (has_active_tab_permission) | 48 if (has_active_tab_permission) |
49 permissions.Append("activeTab"); | 49 permissions.Append("activeTab"); |
50 if (has_tab_capture_permission) | 50 if (has_tab_capture_permission) |
51 permissions.Append("tabCapture"); | 51 permissions.Append("tabCapture"); |
52 return ExtensionBuilder() | 52 return ExtensionBuilder() |
53 .SetManifest(std::move(DictionaryBuilder() | 53 .SetManifest(DictionaryBuilder() |
54 .Set("name", "Extension with ID " + id) | 54 .Set("name", "Extension with ID " + id) |
55 .Set("version", "1.0") | 55 .Set("version", "1.0") |
56 .Set("manifest_version", 2) | 56 .Set("manifest_version", 2) |
57 .Set("permissions", std::move(permissions)))) | 57 .Set("permissions", permissions.Build()) |
| 58 .Build()) |
58 .SetID(id) | 59 .SetID(id) |
59 .Build(); | 60 .Build(); |
60 } | 61 } |
61 | 62 |
62 enum PermittedFeature { | 63 enum PermittedFeature { |
63 PERMITTED_NONE, | 64 PERMITTED_NONE, |
64 PERMITTED_SCRIPT_ONLY, | 65 PERMITTED_SCRIPT_ONLY, |
65 PERMITTED_CAPTURE_ONLY, | 66 PERMITTED_CAPTURE_ONLY, |
66 PERMITTED_BOTH | 67 PERMITTED_BOTH |
67 }; | 68 }; |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 EXPECT_TRUE(permissions_data->HasAPIPermissionForTab( | 375 EXPECT_TRUE(permissions_data->HasAPIPermissionForTab( |
375 tab_id(), APIPermission::kTabCaptureForTab)); | 376 tab_id(), APIPermission::kTabCaptureForTab)); |
376 | 377 |
377 EXPECT_TRUE(IsBlocked(extension_with_tab_capture, internal, tab_id() + 1)); | 378 EXPECT_TRUE(IsBlocked(extension_with_tab_capture, internal, tab_id() + 1)); |
378 EXPECT_FALSE(permissions_data->HasAPIPermissionForTab( | 379 EXPECT_FALSE(permissions_data->HasAPIPermissionForTab( |
379 tab_id() + 1, APIPermission::kTabCaptureForTab)); | 380 tab_id() + 1, APIPermission::kTabCaptureForTab)); |
380 } | 381 } |
381 | 382 |
382 } // namespace | 383 } // namespace |
383 } // namespace extensions | 384 } // namespace extensions |
OLD | NEW |