| 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.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 #include "net/cookies/cookie_store.h" | 132 #include "net/cookies/cookie_store.h" |
| 133 #include "net/url_request/url_request_context.h" | 133 #include "net/url_request/url_request_context.h" |
| 134 #include "net/url_request/url_request_context_getter.h" | 134 #include "net/url_request/url_request_context_getter.h" |
| 135 #include "storage/browser/database/database_tracker.h" | 135 #include "storage/browser/database/database_tracker.h" |
| 136 #include "storage/browser/quota/quota_manager.h" | 136 #include "storage/browser/quota/quota_manager.h" |
| 137 #include "storage/common/database/database_identifier.h" | 137 #include "storage/common/database/database_identifier.h" |
| 138 #include "testing/gmock/include/gmock/gmock.h" | 138 #include "testing/gmock/include/gmock/gmock.h" |
| 139 #include "testing/gtest/include/gtest/gtest.h" | 139 #include "testing/gtest/include/gtest/gtest.h" |
| 140 #include "testing/platform_test.h" | 140 #include "testing/platform_test.h" |
| 141 #include "ui/base/l10n/l10n_util.h" | 141 #include "ui/base/l10n/l10n_util.h" |
| 142 #include "ui/base/material_design/material_design_controller.h" | |
| 143 #include "url/gurl.h" | 142 #include "url/gurl.h" |
| 144 | 143 |
| 145 #if defined(OS_CHROMEOS) | 144 #if defined(OS_CHROMEOS) |
| 146 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" | 145 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" |
| 147 #include "chrome/browser/chromeos/settings/cros_settings.h" | 146 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 148 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 147 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 149 #endif | 148 #endif |
| 150 | 149 |
| 151 // The blacklist tests rely on the safe-browsing database. | 150 // The blacklist tests rely on the safe-browsing database. |
| 152 #if defined(SAFE_BROWSING_DB_LOCAL) | 151 #if defined(SAFE_BROWSING_DB_LOCAL) |
| (...skipping 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 | 2129 |
| 2131 extensions::UnpackedInstaller::Create(service())->Load(extension_path); | 2130 extensions::UnpackedInstaller::Create(service())->Load(extension_path); |
| 2132 base::RunLoop().RunUntilIdle(); | 2131 base::RunLoop().RunUntilIdle(); |
| 2133 EXPECT_EQ(0u, GetErrors().size()); | 2132 EXPECT_EQ(0u, GetErrors().size()); |
| 2134 ASSERT_EQ(1u, loaded_.size()); | 2133 ASSERT_EQ(1u, loaded_.size()); |
| 2135 EXPECT_EQ(1u, registry()->enabled_extensions().size()); | 2134 EXPECT_EQ(1u, registry()->enabled_extensions().size()); |
| 2136 const Extension* theme = registry()->enabled_extensions().begin()->get(); | 2135 const Extension* theme = registry()->enabled_extensions().begin()->get(); |
| 2137 EXPECT_EQ("name", theme->name()); | 2136 EXPECT_EQ("name", theme->name()); |
| 2138 EXPECT_EQ("description", theme->description()); | 2137 EXPECT_EQ("description", theme->description()); |
| 2139 | 2138 |
| 2140 // Cleanup the "Cached Theme.pak" file (or "Cached Theme Material Design.pak" | 2139 // Cleanup the "Cached Theme.pak" file. Ideally, this would be installed in a |
| 2141 // when Material Design is enabled). Ideally, this would be installed in a | |
| 2142 // temporary directory, but it automatically installs to the extension's | 2140 // temporary directory, but it automatically installs to the extension's |
| 2143 // directory, and we don't want to copy the whole extension for a unittest. | 2141 // directory, and we don't want to copy the whole extension for a unittest. |
| 2144 base::FilePath theme_file = extension_path.Append( | 2142 base::FilePath theme_file = extension_path.Append(chrome::kThemePackFilename); |
| 2145 ui::MaterialDesignController::IsModeMaterial() | |
| 2146 ? chrome::kThemePackMaterialDesignFilename | |
| 2147 : chrome::kThemePackFilename); | |
| 2148 ASSERT_TRUE(base::PathExists(theme_file)); | 2143 ASSERT_TRUE(base::PathExists(theme_file)); |
| 2149 ASSERT_TRUE(base::DeleteFile(theme_file, false)); // Not recursive. | 2144 ASSERT_TRUE(base::DeleteFile(theme_file, false)); // Not recursive. |
| 2150 } | 2145 } |
| 2151 | 2146 |
| 2152 #if defined(OS_POSIX) | 2147 #if defined(OS_POSIX) |
| 2153 TEST_F(ExtensionServiceTest, UnpackedExtensionMayContainSymlinkedFiles) { | 2148 TEST_F(ExtensionServiceTest, UnpackedExtensionMayContainSymlinkedFiles) { |
| 2154 base::FilePath source_data_dir = | 2149 base::FilePath source_data_dir = |
| 2155 data_dir().AppendASCII("unpacked").AppendASCII("symlinks_allowed"); | 2150 data_dir().AppendASCII("unpacked").AppendASCII("symlinks_allowed"); |
| 2156 | 2151 |
| 2157 // Paths to test data files. | 2152 // Paths to test data files. |
| (...skipping 4794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6952 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); | 6947 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); |
| 6953 EXPECT_TRUE(registry()->disabled_extensions().Contains(id)); | 6948 EXPECT_TRUE(registry()->disabled_extensions().Contains(id)); |
| 6954 EXPECT_TRUE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); | 6949 EXPECT_TRUE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); |
| 6955 | 6950 |
| 6956 base::FilePath v2_path = data_dir().AppendASCII("good2.crx"); | 6951 base::FilePath v2_path = data_dir().AppendASCII("good2.crx"); |
| 6957 UpdateExtension(id, v2_path, ENABLED); | 6952 UpdateExtension(id, v2_path, ENABLED); |
| 6958 | 6953 |
| 6959 EXPECT_FALSE(registry()->disabled_extensions().Contains(id)); | 6954 EXPECT_FALSE(registry()->disabled_extensions().Contains(id)); |
| 6960 EXPECT_FALSE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); | 6955 EXPECT_FALSE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); |
| 6961 } | 6956 } |
| OLD | NEW |