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 "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 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2257 FilePath path = data_dir_.AppendASCII("good.crx"); | 2257 FilePath path = data_dir_.AppendASCII("good.crx"); |
2258 | 2258 |
2259 const Extension* good = InstallCRX(path, INSTALL_NEW); | 2259 const Extension* good = InstallCRX(path, INSTALL_NEW); |
2260 ASSERT_EQ("1.0.0.0", good->VersionString()); | 2260 ASSERT_EQ("1.0.0.0", good->VersionString()); |
2261 ASSERT_EQ(good_crx, good->id()); | 2261 ASSERT_EQ(good_crx, good->id()); |
2262 | 2262 |
2263 // Disable it and allow it to run in incognito. These settings should carry | 2263 // Disable it and allow it to run in incognito. These settings should carry |
2264 // over to the updated version. | 2264 // over to the updated version. |
2265 service_->DisableExtension(good->id()); | 2265 service_->DisableExtension(good->id()); |
2266 service_->SetIsIncognitoEnabled(good->id(), true); | 2266 service_->SetIsIncognitoEnabled(good->id(), true); |
| 2267 service_->extension_prefs()->SetDidExtensionEscalatePermissions(good, true); |
2267 | 2268 |
2268 path = data_dir_.AppendASCII("good2.crx"); | 2269 path = data_dir_.AppendASCII("good2.crx"); |
2269 UpdateExtension(good_crx, path, INSTALLED); | 2270 UpdateExtension(good_crx, path, INSTALLED); |
2270 ASSERT_EQ(1u, service_->disabled_extensions()->size()); | 2271 ASSERT_EQ(1u, service_->disabled_extensions()->size()); |
2271 const Extension* good2 = service_->GetExtensionById(good_crx, true); | 2272 const Extension* good2 = service_->GetExtensionById(good_crx, true); |
2272 ASSERT_EQ("1.0.0.1", good2->version()->GetString()); | 2273 ASSERT_EQ("1.0.0.1", good2->version()->GetString()); |
2273 EXPECT_TRUE(service_->IsIncognitoEnabled(good2->id())); | 2274 EXPECT_TRUE(service_->IsIncognitoEnabled(good2->id())); |
| 2275 EXPECT_TRUE(service_->extension_prefs()->DidExtensionEscalatePermissions( |
| 2276 good2->id())); |
2274 } | 2277 } |
2275 | 2278 |
2276 // Tests that updating preserves extension location. | 2279 // Tests that updating preserves extension location. |
2277 TEST_F(ExtensionServiceTest, UpdateExtensionPreservesLocation) { | 2280 TEST_F(ExtensionServiceTest, UpdateExtensionPreservesLocation) { |
2278 InitializeEmptyExtensionService(); | 2281 InitializeEmptyExtensionService(); |
2279 | 2282 |
2280 FilePath path = data_dir_.AppendASCII("good.crx"); | 2283 FilePath path = data_dir_.AppendASCII("good.crx"); |
2281 | 2284 |
2282 const Extension* good = | 2285 const Extension* good = |
2283 InstallCRXWithLocation(path, Extension::EXTERNAL_PREF, INSTALL_NEW); | 2286 InstallCRXWithLocation(path, Extension::EXTERNAL_PREF, INSTALL_NEW); |
(...skipping 2572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4856 provider->UpdateOrAddExtension(hosted_app, "1.0.0.0", | 4859 provider->UpdateOrAddExtension(hosted_app, "1.0.0.0", |
4857 data_dir_.AppendASCII("hosted_app.crx")); | 4860 data_dir_.AppendASCII("hosted_app.crx")); |
4858 | 4861 |
4859 service_->CheckForExternalUpdates(); | 4862 service_->CheckForExternalUpdates(); |
4860 loop_.RunAllPending(); | 4863 loop_.RunAllPending(); |
4861 | 4864 |
4862 ASSERT_TRUE(service_->PopulateExtensionGlobalError( | 4865 ASSERT_TRUE(service_->PopulateExtensionGlobalError( |
4863 extension_global_error.get())); | 4866 extension_global_error.get())); |
4864 ASSERT_EQ(1u, extension_global_error->get_external_extension_ids()->size()); | 4867 ASSERT_EQ(1u, extension_global_error->get_external_extension_ids()->size()); |
4865 } | 4868 } |
OLD | NEW |