| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/extensions/extension_service_unittest.h" | 5 #include "chrome/browser/extensions/extension_service_unittest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 #include "extensions/browser/management_policy.h" | 95 #include "extensions/browser/management_policy.h" |
| 96 #include "extensions/browser/pref_names.h" | 96 #include "extensions/browser/pref_names.h" |
| 97 #include "extensions/browser/test_management_policy.h" | 97 #include "extensions/browser/test_management_policy.h" |
| 98 #include "extensions/common/constants.h" | 98 #include "extensions/common/constants.h" |
| 99 #include "extensions/common/extension.h" | 99 #include "extensions/common/extension.h" |
| 100 #include "extensions/common/extension_builder.h" | 100 #include "extensions/common/extension_builder.h" |
| 101 #include "extensions/common/extension_resource.h" | 101 #include "extensions/common/extension_resource.h" |
| 102 #include "extensions/common/manifest_constants.h" | 102 #include "extensions/common/manifest_constants.h" |
| 103 #include "extensions/common/manifest_handlers/background_info.h" | 103 #include "extensions/common/manifest_handlers/background_info.h" |
| 104 #include "extensions/common/permissions/permission_set.h" | 104 #include "extensions/common/permissions/permission_set.h" |
| 105 #include "extensions/common/switches.h" |
| 105 #include "extensions/common/url_pattern.h" | 106 #include "extensions/common/url_pattern.h" |
| 106 #include "extensions/common/value_builder.h" | 107 #include "extensions/common/value_builder.h" |
| 107 #include "gpu/config/gpu_info.h" | 108 #include "gpu/config/gpu_info.h" |
| 108 #include "grit/browser_resources.h" | 109 #include "grit/browser_resources.h" |
| 109 #include "net/cookies/canonical_cookie.h" | 110 #include "net/cookies/canonical_cookie.h" |
| 110 #include "net/cookies/cookie_monster.h" | 111 #include "net/cookies/cookie_monster.h" |
| 111 #include "net/cookies/cookie_options.h" | 112 #include "net/cookies/cookie_options.h" |
| 112 #include "net/url_request/url_request_context.h" | 113 #include "net/url_request/url_request_context.h" |
| 113 #include "net/url_request/url_request_context_getter.h" | 114 #include "net/url_request/url_request_context_getter.h" |
| 114 #include "sync/api/fake_sync_change_processor.h" | 115 #include "sync/api/fake_sync_change_processor.h" |
| (...skipping 6414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6529 false)); | 6530 false)); |
| 6530 EXPECT_TRUE((info = pending->GetById(kGoodId))); | 6531 EXPECT_TRUE((info = pending->GetById(kGoodId))); |
| 6531 EXPECT_FALSE(info->version().IsValid()); | 6532 EXPECT_FALSE(info->version().IsValid()); |
| 6532 } | 6533 } |
| 6533 | 6534 |
| 6534 // This makes sure we can package and install CRX files that use whitelisted | 6535 // This makes sure we can package and install CRX files that use whitelisted |
| 6535 // permissions. | 6536 // permissions. |
| 6536 TEST_F(ExtensionServiceTest, InstallWhitelistedExtension) { | 6537 TEST_F(ExtensionServiceTest, InstallWhitelistedExtension) { |
| 6537 std::string test_id = "hdkklepkcpckhnpgjnmbdfhehckloojk"; | 6538 std::string test_id = "hdkklepkcpckhnpgjnmbdfhehckloojk"; |
| 6538 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 6539 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 6539 switches::kWhitelistedExtensionID, test_id); | 6540 extensions::switches::kWhitelistedExtensionID, test_id); |
| 6540 | 6541 |
| 6541 InitializeEmptyExtensionService(); | 6542 InitializeEmptyExtensionService(); |
| 6542 base::FilePath path = data_dir_ | 6543 base::FilePath path = data_dir_ |
| 6543 .AppendASCII("permissions"); | 6544 .AppendASCII("permissions"); |
| 6544 base::FilePath pem_path = path | 6545 base::FilePath pem_path = path |
| 6545 .AppendASCII("whitelist.pem"); | 6546 .AppendASCII("whitelist.pem"); |
| 6546 path = path | 6547 path = path |
| 6547 .AppendASCII("whitelist"); | 6548 .AppendASCII("whitelist"); |
| 6548 | 6549 |
| 6549 const Extension* extension = PackAndInstallCRX(path, pem_path, INSTALL_NEW); | 6550 const Extension* extension = PackAndInstallCRX(path, pem_path, INSTALL_NEW); |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7002 // ReconcileKnownDisabled(). | 7003 // ReconcileKnownDisabled(). |
| 7003 service_->EnableExtension(good2); | 7004 service_->EnableExtension(good2); |
| 7004 service_->ReconcileKnownDisabled(); | 7005 service_->ReconcileKnownDisabled(); |
| 7005 expected_extensions.insert(good2); | 7006 expected_extensions.insert(good2); |
| 7006 expected_disabled_extensions.erase(good2); | 7007 expected_disabled_extensions.erase(good2); |
| 7007 | 7008 |
| 7008 EXPECT_EQ(expected_extensions, registry_->enabled_extensions().GetIDs()); | 7009 EXPECT_EQ(expected_extensions, registry_->enabled_extensions().GetIDs()); |
| 7009 EXPECT_EQ(expected_disabled_extensions, | 7010 EXPECT_EQ(expected_disabled_extensions, |
| 7010 registry_->disabled_extensions().GetIDs()); | 7011 registry_->disabled_extensions().GetIDs()); |
| 7011 } | 7012 } |
| OLD | NEW |