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