Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
| 15 #include "base/json/json_reader.h" | 15 #include "base/json/json_reader.h" |
| 16 #include "base/json/json_value_serializer.h" | 16 #include "base/json/json_value_serializer.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
| 19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 20 #include "base/scoped_temp_dir.h" | 20 #include "base/scoped_temp_dir.h" |
| 21 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
| 22 #include "base/string16.h" | 22 #include "base/string16.h" |
| 23 #include "base/string_number_conversions.h" | 23 #include "base/string_number_conversions.h" |
| 24 #include "base/string_util.h" | 24 #include "base/string_util.h" |
| 25 #include "base/utf_string_conversions.h" | 25 #include "base/utf_string_conversions.h" |
| 26 #include "base/version.h" | 26 #include "base/version.h" |
| 27 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
| 28 #include "chrome/browser/extensions/component_loader.h" | |
| 28 #include "chrome/browser/extensions/crx_installer.h" | 29 #include "chrome/browser/extensions/crx_installer.h" |
| 29 #include "chrome/browser/extensions/component_loader.h" | |
| 30 #include "chrome/browser/extensions/extension_creator.h" | 30 #include "chrome/browser/extensions/extension_creator.h" |
| 31 #include "chrome/browser/extensions/extension_error_reporter.h" | 31 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 32 #include "chrome/browser/extensions/extension_service.h" | 32 #include "chrome/browser/extensions/extension_service.h" |
| 33 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 33 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 34 #include "chrome/browser/extensions/extension_sync_data.h" | 34 #include "chrome/browser/extensions/extension_sync_data.h" |
| 35 #include "chrome/browser/extensions/extension_updater.h" | 35 #include "chrome/browser/extensions/extension_updater.h" |
| 36 #include "chrome/browser/extensions/external_extension_provider_impl.h" | 36 #include "chrome/browser/extensions/external_extension_provider_impl.h" |
| 37 #include "chrome/browser/extensions/external_extension_provider_interface.h" | 37 #include "chrome/browser/extensions/external_extension_provider_interface.h" |
| 38 #include "chrome/browser/extensions/external_pref_extension_loader.h" | 38 #include "chrome/browser/extensions/external_pref_extension_loader.h" |
| 39 #include "chrome/browser/extensions/installed_loader.h" | 39 #include "chrome/browser/extensions/installed_loader.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 67 #include "content/test/test_browser_thread.h" | 67 #include "content/test/test_browser_thread.h" |
| 68 #include "googleurl/src/gurl.h" | 68 #include "googleurl/src/gurl.h" |
| 69 #include "net/base/cookie_monster.h" | 69 #include "net/base/cookie_monster.h" |
| 70 #include "net/base/cookie_options.h" | 70 #include "net/base/cookie_options.h" |
| 71 #include "net/url_request/url_request_context.h" | 71 #include "net/url_request/url_request_context.h" |
| 72 #include "net/url_request/url_request_context_getter.h" | 72 #include "net/url_request/url_request_context_getter.h" |
| 73 #include "testing/gtest/include/gtest/gtest.h" | 73 #include "testing/gtest/include/gtest/gtest.h" |
| 74 #include "testing/platform_test.h" | 74 #include "testing/platform_test.h" |
| 75 #include "webkit/database/database_tracker.h" | 75 #include "webkit/database/database_tracker.h" |
| 76 #include "webkit/database/database_util.h" | 76 #include "webkit/database/database_util.h" |
| 77 #include "webkit/plugins/npapi/mock_plugin_list.h" | |
| 77 #include "webkit/quota/quota_manager.h" | 78 #include "webkit/quota/quota_manager.h" |
| 78 | 79 |
| 79 using content::BrowserThread; | 80 using content::BrowserThread; |
| 80 | 81 |
| 81 namespace keys = extension_manifest_keys; | 82 namespace keys = extension_manifest_keys; |
| 82 | 83 |
| 83 namespace { | 84 namespace { |
| 84 | 85 |
| 85 // Extension ids used during testing. | 86 // Extension ids used during testing. |
| 86 const char* const all_zero = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | 87 const char* const all_zero = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; |
| (...skipping 3507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3594 TEST(ExtensionServiceTestSimple, Enabledness) { | 3595 TEST(ExtensionServiceTestSimple, Enabledness) { |
| 3595 ExtensionErrorReporter::Init(false); // no noisy errors | 3596 ExtensionErrorReporter::Init(false); // no noisy errors |
| 3596 ExtensionsReadyRecorder recorder; | 3597 ExtensionsReadyRecorder recorder; |
| 3597 scoped_ptr<TestingProfile> profile(new TestingProfile()); | 3598 scoped_ptr<TestingProfile> profile(new TestingProfile()); |
| 3598 MessageLoop loop; | 3599 MessageLoop loop; |
| 3599 content::TestBrowserThread ui_thread(BrowserThread::UI, &loop); | 3600 content::TestBrowserThread ui_thread(BrowserThread::UI, &loop); |
| 3600 content::TestBrowserThread file_thread(BrowserThread::FILE, &loop); | 3601 content::TestBrowserThread file_thread(BrowserThread::FILE, &loop); |
| 3601 scoped_ptr<CommandLine> command_line; | 3602 scoped_ptr<CommandLine> command_line; |
| 3602 FilePath install_dir = profile->GetPath() | 3603 FilePath install_dir = profile->GetPath() |
| 3603 .AppendASCII(ExtensionService::kInstallDirectoryName); | 3604 .AppendASCII(ExtensionService::kInstallDirectoryName); |
| 3605 webkit::npapi::MockPluginList plugin_list(NULL, 0); | |
| 3606 PluginService::GetInstance()->SetPluginListForTesting(&plugin_list); | |
|
Matt Perry
2011/12/12 20:00:22
Seems like this would fix the crash you saw, but I
miket_OOO
2011/12/12 21:18:21
I know why this is happening. I have out/Debug/def
| |
| 3604 | 3607 |
| 3605 // By default, we are enabled. | 3608 // By default, we are enabled. |
| 3606 command_line.reset(new CommandLine(CommandLine::NO_PROGRAM)); | 3609 command_line.reset(new CommandLine(CommandLine::NO_PROGRAM)); |
| 3607 // Owned by |profile|. | 3610 // Owned by |profile|. |
| 3608 ExtensionService* service = | 3611 ExtensionService* service = |
| 3609 profile->CreateExtensionService(command_line.get(), | 3612 profile->CreateExtensionService(command_line.get(), |
| 3610 install_dir, | 3613 install_dir, |
| 3611 false); | 3614 false); |
| 3612 EXPECT_TRUE(service->extensions_enabled()); | 3615 EXPECT_TRUE(service->extensions_enabled()); |
| 3613 service->Init(); | 3616 service->Init(); |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4292 ASSERT_FALSE(AddPendingSyncInstall()); | 4295 ASSERT_FALSE(AddPendingSyncInstall()); |
| 4293 | 4296 |
| 4294 // Wait for the external source to install. | 4297 // Wait for the external source to install. |
| 4295 WaitForCrxInstall(crx_path_, INSTALL_NEW); | 4298 WaitForCrxInstall(crx_path_, INSTALL_NEW); |
| 4296 ASSERT_TRUE(IsCrxInstalled()); | 4299 ASSERT_TRUE(IsCrxInstalled()); |
| 4297 | 4300 |
| 4298 // Now that the extension is installed, sync request should fail | 4301 // Now that the extension is installed, sync request should fail |
| 4299 // because the extension is already installed. | 4302 // because the extension is already installed. |
| 4300 ASSERT_FALSE(AddPendingSyncInstall()); | 4303 ASSERT_FALSE(AddPendingSyncInstall()); |
| 4301 } | 4304 } |
| OLD | NEW |