| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/json/json_file_value_serializer.h" | 6 #include "base/json/json_file_value_serializer.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
| 11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 12 #include "chrome/common/extensions/api/plugins/plugins_handler.h" | 12 #include "chrome/common/extensions/api/plugins/plugins_handler.h" |
| 13 #include "chrome/common/extensions/background_info.h" | 13 #include "chrome/common/extensions/background_info.h" |
| 14 #include "chrome/common/extensions/extension.h" | 14 #include "chrome/common/extensions/extension.h" |
| 15 #include "chrome/common/extensions/features/feature.h" | 15 #include "chrome/common/extensions/features/feature.h" |
| 16 #include "chrome/common/extensions/manifest_handler.h" | 16 #include "chrome/common/extensions/manifest_handler.h" |
| 17 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" |
| 17 #include "chrome/common/extensions/permissions/permission_set.h" | 18 #include "chrome/common/extensions/permissions/permission_set.h" |
| 18 #include "chrome/common/extensions/permissions/permissions_info.h" | 19 #include "chrome/common/extensions/permissions/permissions_info.h" |
| 19 #include "chrome/common/extensions/permissions/socket_permission.h" | 20 #include "chrome/common/extensions/permissions/socket_permission.h" |
| 20 #include "extensions/common/error_utils.h" | 21 #include "extensions/common/error_utils.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 23 |
| 23 using extensions::Extension; | 24 using extensions::Extension; |
| 24 | 25 |
| 25 namespace extensions { | 26 namespace extensions { |
| 26 | 27 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return warnings.size(); | 71 return warnings.size(); |
| 71 } | 72 } |
| 72 | 73 |
| 73 bool Contains(const std::vector<string16>& warnings, | 74 bool Contains(const std::vector<string16>& warnings, |
| 74 const std::string& warning) { | 75 const std::string& warning) { |
| 75 return IndexOf(warnings, warning) != warnings.size(); | 76 return IndexOf(warnings, warning) != warnings.size(); |
| 76 } | 77 } |
| 77 | 78 |
| 78 } // namespace | 79 } // namespace |
| 79 | 80 |
| 80 | |
| 81 class PermissionsTest : public testing::Test { | 81 class PermissionsTest : public testing::Test { |
| 82 protected: |
| 82 virtual void SetUp() OVERRIDE { | 83 virtual void SetUp() OVERRIDE { |
| 83 testing::Test::SetUp(); | 84 testing::Test::SetUp(); |
| 84 (new BackgroundManifestHandler)->Register(); | 85 (new BackgroundManifestHandler)->Register(); |
| 86 (new ContentScriptsHandler)->Register(); |
| 85 (new PluginsHandler)->Register(); | 87 (new PluginsHandler)->Register(); |
| 86 } | 88 } |
| 87 | 89 |
| 88 virtual void TearDown() OVERRIDE { | 90 virtual void TearDown() OVERRIDE { |
| 89 ManifestHandler::ClearRegistryForTesting(); | 91 ManifestHandler::ClearRegistryForTesting(); |
| 90 testing::Test::TearDown(); | 92 testing::Test::TearDown(); |
| 91 } | 93 } |
| 92 }; | 94 }; |
| 93 | 95 |
| 94 // Tests GetByID. | 96 // Tests GetByID. |
| (...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1372 apis.insert(APIPermission::kWebRequest); | 1374 apis.insert(APIPermission::kWebRequest); |
| 1373 apis.insert(APIPermission::kFileBrowserHandler); | 1375 apis.insert(APIPermission::kFileBrowserHandler); |
| 1374 EXPECT_EQ(2U, apis.size()); | 1376 EXPECT_EQ(2U, apis.size()); |
| 1375 | 1377 |
| 1376 scoped_refptr<PermissionSet> perm_set; | 1378 scoped_refptr<PermissionSet> perm_set; |
| 1377 perm_set = new PermissionSet(apis, empty_extent, empty_extent); | 1379 perm_set = new PermissionSet(apis, empty_extent, empty_extent); |
| 1378 EXPECT_EQ(4U, perm_set->apis().size()); | 1380 EXPECT_EQ(4U, perm_set->apis().size()); |
| 1379 } | 1381 } |
| 1380 | 1382 |
| 1381 } // namespace extensions | 1383 } // namespace extensions |
| OLD | NEW |