Chromium Code Reviews| 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 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2128 | 2127 |
| 2129 extensions::UnpackedInstaller::Create(service())->Load(extension_path); | 2128 extensions::UnpackedInstaller::Create(service())->Load(extension_path); |
| 2130 base::RunLoop().RunUntilIdle(); | 2129 base::RunLoop().RunUntilIdle(); |
| 2131 EXPECT_EQ(0u, GetErrors().size()); | 2130 EXPECT_EQ(0u, GetErrors().size()); |
| 2132 ASSERT_EQ(1u, loaded_.size()); | 2131 ASSERT_EQ(1u, loaded_.size()); |
| 2133 EXPECT_EQ(1u, registry()->enabled_extensions().size()); | 2132 EXPECT_EQ(1u, registry()->enabled_extensions().size()); |
| 2134 const Extension* theme = registry()->enabled_extensions().begin()->get(); | 2133 const Extension* theme = registry()->enabled_extensions().begin()->get(); |
| 2135 EXPECT_EQ("name", theme->name()); | 2134 EXPECT_EQ("name", theme->name()); |
| 2136 EXPECT_EQ("description", theme->description()); | 2135 EXPECT_EQ("description", theme->description()); |
| 2137 | 2136 |
| 2138 // Cleanup the "Cached Theme.pak" file (or "Cached Theme Material Design.pak" | 2137 // Cleanup the "Cached Theme.pak" file. Ideally, this would be installed in a |
| 2139 // when Material Design is enabled). Ideally, this would be installed in a | |
| 2140 // temporary directory, but it automatically installs to the extension's | 2138 // temporary directory, but it automatically installs to the extension's |
| 2141 // directory, and we don't want to copy the whole extension for a unittest. | 2139 // directory, and we don't want to copy the whole extension for a unittest. |
| 2142 base::FilePath theme_file = extension_path.Append( | 2140 base::FilePath theme_file = extension_path.Append(chrome::kThemePackFilename); |
| 2143 ui::MaterialDesignController::IsModeMaterial() | |
| 2144 ? chrome::kThemePackMaterialDesignFilename | |
|
Peter Kasting
2016/10/26 03:28:46
Do we need some kind of cleanup pass to avoid leav
Evan Stade
2016/11/02 00:41:13
I suppose that would be good. .pak files are a few
| |
| 2145 : chrome::kThemePackFilename); | |
| 2146 ASSERT_TRUE(base::PathExists(theme_file)); | 2141 ASSERT_TRUE(base::PathExists(theme_file)); |
| 2147 ASSERT_TRUE(base::DeleteFile(theme_file, false)); // Not recursive. | 2142 ASSERT_TRUE(base::DeleteFile(theme_file, false)); // Not recursive. |
| 2148 } | 2143 } |
| 2149 | 2144 |
| 2150 #if defined(OS_POSIX) | 2145 #if defined(OS_POSIX) |
| 2151 TEST_F(ExtensionServiceTest, UnpackedExtensionMayContainSymlinkedFiles) { | 2146 TEST_F(ExtensionServiceTest, UnpackedExtensionMayContainSymlinkedFiles) { |
| 2152 base::FilePath source_data_dir = | 2147 base::FilePath source_data_dir = |
| 2153 data_dir().AppendASCII("unpacked").AppendASCII("symlinks_allowed"); | 2148 data_dir().AppendASCII("unpacked").AppendASCII("symlinks_allowed"); |
| 2154 | 2149 |
| 2155 // Paths to test data files. | 2150 // Paths to test data files. |
| (...skipping 4794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6950 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); | 6945 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); |
| 6951 EXPECT_TRUE(registry()->disabled_extensions().Contains(id)); | 6946 EXPECT_TRUE(registry()->disabled_extensions().Contains(id)); |
| 6952 EXPECT_TRUE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); | 6947 EXPECT_TRUE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); |
| 6953 | 6948 |
| 6954 base::FilePath v2_path = data_dir().AppendASCII("good2.crx"); | 6949 base::FilePath v2_path = data_dir().AppendASCII("good2.crx"); |
| 6955 UpdateExtension(id, v2_path, ENABLED); | 6950 UpdateExtension(id, v2_path, ENABLED); |
| 6956 | 6951 |
| 6957 EXPECT_FALSE(registry()->disabled_extensions().Contains(id)); | 6952 EXPECT_FALSE(registry()->disabled_extensions().Contains(id)); |
| 6958 EXPECT_FALSE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); | 6953 EXPECT_FALSE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); |
| 6959 } | 6954 } |
| OLD | NEW |