OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 <algorithm> | 5 #include <algorithm> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 loop_.RunAllPending(); | 1220 loop_.RunAllPending(); |
1221 ASSERT_EQ(0u, loaded_.size()); | 1221 ASSERT_EQ(0u, loaded_.size()); |
1222 ValidatePrefKeyCount(0); | 1222 ValidatePrefKeyCount(0); |
1223 | 1223 |
1224 // The extension should also be gone from the install directory. | 1224 // The extension should also be gone from the install directory. |
1225 ASSERT_FALSE(file_util::PathExists(install_path)); | 1225 ASSERT_FALSE(file_util::PathExists(install_path)); |
1226 } | 1226 } |
1227 | 1227 |
1228 #endif | 1228 #endif |
1229 | 1229 |
1230 // TODO(rafaelw): Re-enable on mac. This broke with: | |
1231 // http://codereview.chromium.org/140018 | |
1232 #if !defined(OS_MACOSX) | |
1233 | |
1234 TEST_F(ExtensionsServiceTest, ExternalInstallPref) { | 1230 TEST_F(ExtensionsServiceTest, ExternalInstallPref) { |
1235 InitializeEmptyExtensionsService(); | 1231 InitializeEmptyExtensionsService(); |
1236 // Verify that starting with no providers loads no extensions. | 1232 // Verify that starting with no providers loads no extensions. |
1237 service_->Init(); | 1233 service_->Init(); |
1238 loop_.RunAllPending(); | 1234 loop_.RunAllPending(); |
1239 ASSERT_EQ(0u, loaded_.size()); | 1235 ASSERT_EQ(0u, loaded_.size()); |
1240 | 1236 |
1241 // Now add providers. Extension system takes ownership of the objects. | 1237 // Now add providers. Extension system takes ownership of the objects. |
1242 MockExtensionProvider* pref_provider = | 1238 MockExtensionProvider* pref_provider = |
1243 new MockExtensionProvider(Extension::EXTERNAL_PREF); | 1239 new MockExtensionProvider(Extension::EXTERNAL_PREF); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 pref_provider->UpdateOrAddExtension(good_crx, "1.0", source_path); | 1333 pref_provider->UpdateOrAddExtension(good_crx, "1.0", source_path); |
1338 service_->CheckForUpdates(); | 1334 service_->CheckForUpdates(); |
1339 loop_.RunAllPending(); | 1335 loop_.RunAllPending(); |
1340 | 1336 |
1341 ASSERT_EQ(0u, loaded_.size()); | 1337 ASSERT_EQ(0u, loaded_.size()); |
1342 ASSERT_EQ(1u, GetErrors().size()); | 1338 ASSERT_EQ(1u, GetErrors().size()); |
1343 ASSERT_TRUE(GetErrors()[0].find("Extensions are not enabled") != | 1339 ASSERT_TRUE(GetErrors()[0].find("Extensions are not enabled") != |
1344 std::string::npos); | 1340 std::string::npos); |
1345 } | 1341 } |
1346 | 1342 |
1347 #endif // !defined(OS_MACOSX) | |
1348 | |
1349 TEST_F(ExtensionsServiceTest, ExternalPrefProvider) { | 1343 TEST_F(ExtensionsServiceTest, ExternalPrefProvider) { |
1350 InitializeEmptyExtensionsService(); | 1344 InitializeEmptyExtensionsService(); |
1351 std::string json_data = | 1345 std::string json_data = |
1352 "{" | 1346 "{" |
1353 "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\": {" | 1347 "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\": {" |
1354 "\"external_crx\": \"RandomExtension.crx\"," | 1348 "\"external_crx\": \"RandomExtension.crx\"," |
1355 "\"external_version\": \"1.0\"" | 1349 "\"external_version\": \"1.0\"" |
1356 "}," | 1350 "}," |
1357 "\"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\": {" | 1351 "\"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\": {" |
1358 "\"external_crx\": \"RandomExtension2.crx\"," | 1352 "\"external_crx\": \"RandomExtension2.crx\"," |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 | 1460 |
1467 recorder.set_ready(false); | 1461 recorder.set_ready(false); |
1468 command_line.reset(new CommandLine(L"")); | 1462 command_line.reset(new CommandLine(L"")); |
1469 service = new ExtensionsService(&profile, command_line.get(), | 1463 service = new ExtensionsService(&profile, command_line.get(), |
1470 profile.GetPrefs(), install_dir, &loop, &loop); | 1464 profile.GetPrefs(), install_dir, &loop, &loop); |
1471 EXPECT_TRUE(service->extensions_enabled()); | 1465 EXPECT_TRUE(service->extensions_enabled()); |
1472 service->Init(); | 1466 service->Init(); |
1473 loop.RunAllPending(); | 1467 loop.RunAllPending(); |
1474 EXPECT_TRUE(recorder.ready()); | 1468 EXPECT_TRUE(recorder.ready()); |
1475 } | 1469 } |
OLD | NEW |