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_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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 #include "chrome/common/chrome_constants.h" | 61 #include "chrome/common/chrome_constants.h" |
| 62 #include "chrome/common/chrome_notification_types.h" | 62 #include "chrome/common/chrome_notification_types.h" |
| 63 #include "chrome/common/chrome_paths.h" | 63 #include "chrome/common/chrome_paths.h" |
| 64 #include "chrome/common/chrome_switches.h" | 64 #include "chrome/common/chrome_switches.h" |
| 65 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" | 65 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" |
| 66 #include "chrome/common/extensions/api/plugins/plugins_handler.h" | 66 #include "chrome/common/extensions/api/plugins/plugins_handler.h" |
| 67 #include "chrome/common/extensions/background_info.h" | 67 #include "chrome/common/extensions/background_info.h" |
| 68 #include "chrome/common/extensions/extension.h" | 68 #include "chrome/common/extensions/extension.h" |
| 69 #include "chrome/common/extensions/extension_l10n_util.h" | 69 #include "chrome/common/extensions/extension_l10n_util.h" |
| 70 #include "chrome/common/extensions/extension_manifest_constants.h" | 70 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 71 #include "chrome/common/extensions/extension_messages.h" | |
| 71 #include "chrome/common/extensions/manifest_handler.h" | 72 #include "chrome/common/extensions/manifest_handler.h" |
| 72 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" | 73 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" |
| 73 #include "chrome/common/extensions/manifest_handlers/requirements_handler.h" | 74 #include "chrome/common/extensions/manifest_handlers/requirements_handler.h" |
| 74 #include "chrome/common/extensions/manifest_url_handler.h" | 75 #include "chrome/common/extensions/manifest_url_handler.h" |
| 75 #include "chrome/common/extensions/permissions/permission_set.h" | 76 #include "chrome/common/extensions/permissions/permission_set.h" |
| 76 #include "chrome/common/pref_names.h" | 77 #include "chrome/common/pref_names.h" |
| 77 #include "chrome/common/url_constants.h" | 78 #include "chrome/common/url_constants.h" |
| 78 #include "chrome/test/base/testing_profile.h" | 79 #include "chrome/test/base/testing_profile.h" |
| 79 #include "components/user_prefs/pref_registry_syncable.h" | 80 #include "components/user_prefs/pref_registry_syncable.h" |
| 80 #include "content/public/browser/dom_storage_context.h" | 81 #include "content/public/browser/dom_storage_context.h" |
| 81 #include "content/public/browser/gpu_data_manager.h" | 82 #include "content/public/browser/gpu_data_manager.h" |
| 82 #include "content/public/browser/indexed_db_context.h" | 83 #include "content/public/browser/indexed_db_context.h" |
| 83 #include "content/public/browser/notification_registrar.h" | 84 #include "content/public/browser/notification_registrar.h" |
| 84 #include "content/public/browser/notification_service.h" | 85 #include "content/public/browser/notification_service.h" |
| 85 #include "content/public/browser/plugin_service.h" | 86 #include "content/public/browser/plugin_service.h" |
| 86 #include "content/public/browser/storage_partition.h" | 87 #include "content/public/browser/storage_partition.h" |
| 87 #include "content/public/common/content_constants.h" | 88 #include "content/public/common/content_constants.h" |
| 88 #include "content/public/common/gpu_info.h" | 89 #include "content/public/common/gpu_info.h" |
| 90 #include "content/public/test/mock_render_process_host.h" | |
| 89 #include "content/public/test/test_browser_thread.h" | 91 #include "content/public/test/test_browser_thread.h" |
| 92 #include "content/public/test/test_content_client_initializer.h" | |
| 93 #include "content/public/test/test_notification_tracker.h" | |
| 90 #include "extensions/common/constants.h" | 94 #include "extensions/common/constants.h" |
| 91 #include "extensions/common/extension_resource.h" | 95 #include "extensions/common/extension_resource.h" |
| 92 #include "extensions/common/url_pattern.h" | 96 #include "extensions/common/url_pattern.h" |
| 93 #include "googleurl/src/gurl.h" | 97 #include "googleurl/src/gurl.h" |
| 94 #include "grit/browser_resources.h" | 98 #include "grit/browser_resources.h" |
| 95 #include "net/cookies/canonical_cookie.h" | 99 #include "net/cookies/canonical_cookie.h" |
| 96 #include "net/cookies/cookie_monster.h" | 100 #include "net/cookies/cookie_monster.h" |
| 97 #include "net/cookies/cookie_options.h" | 101 #include "net/cookies/cookie_options.h" |
| 98 #include "net/url_request/url_request_context.h" | 102 #include "net/url_request/url_request_context.h" |
| 99 #include "net/url_request/url_request_context_getter.h" | 103 #include "net/url_request/url_request_context_getter.h" |
| 100 #include "sync/api/string_ordinal.h" | 104 #include "sync/api/string_ordinal.h" |
| 101 #include "sync/api/sync_error_factory.h" | 105 #include "sync/api/sync_error_factory.h" |
| 102 #include "sync/api/sync_error_factory_mock.h" | 106 #include "sync/api/sync_error_factory_mock.h" |
| 103 #include "sync/protocol/app_specifics.pb.h" | 107 #include "sync/protocol/app_specifics.pb.h" |
| 104 #include "sync/protocol/extension_specifics.pb.h" | 108 #include "sync/protocol/extension_specifics.pb.h" |
| 105 #include "sync/protocol/sync.pb.h" | 109 #include "sync/protocol/sync.pb.h" |
| 110 #include "testing/gmock/include/gmock/gmock.h" | |
| 106 #include "testing/gtest/include/gtest/gtest.h" | 111 #include "testing/gtest/include/gtest/gtest.h" |
| 107 #include "testing/platform_test.h" | 112 #include "testing/platform_test.h" |
| 108 #include "webkit/database/database_tracker.h" | 113 #include "webkit/database/database_tracker.h" |
| 109 #include "webkit/database/database_util.h" | 114 #include "webkit/database/database_util.h" |
| 110 #include "webkit/plugins/npapi/mock_plugin_list.h" | 115 #include "webkit/plugins/npapi/mock_plugin_list.h" |
| 111 #include "webkit/quota/quota_manager.h" | 116 #include "webkit/quota/quota_manager.h" |
| 112 | 117 |
| 113 #if defined(OS_CHROMEOS) | 118 #if defined(OS_CHROMEOS) |
| 114 #include "chrome/browser/chromeos/extensions/install_limiter.h" | 119 #include "chrome/browser/chromeos/extensions/install_limiter.h" |
| 115 #endif | 120 #endif |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 501 file_util::CopyDirectory(source_install_dir, extensions_install_dir_, true); | 506 file_util::CopyDirectory(source_install_dir, extensions_install_dir_, true); |
| 502 | 507 |
| 503 InitializeExtensionService(path, temp_prefs, extensions_install_dir_, false); | 508 InitializeExtensionService(path, temp_prefs, extensions_install_dir_, false); |
| 504 } | 509 } |
| 505 | 510 |
| 506 void ExtensionServiceTestBase::InitializeEmptyExtensionService() { | 511 void ExtensionServiceTestBase::InitializeEmptyExtensionService() { |
| 507 InitializeExtensionServiceHelper(false); | 512 InitializeExtensionServiceHelper(false); |
| 508 } | 513 } |
| 509 | 514 |
| 510 void ExtensionServiceTestBase::InitializeExtensionProcessManager() { | 515 void ExtensionServiceTestBase::InitializeExtensionProcessManager() { |
| 511 static_cast<extensions::TestExtensionSystem*>( | 516 extensions::TestExtensionSystem* system = |
| 512 ExtensionSystem::Get(profile_.get()))-> | 517 static_cast<extensions::TestExtensionSystem*>( |
| 513 CreateExtensionProcessManager(); | 518 ExtensionSystem::Get(profile_.get())); |
| 519 system->CreateExtensionProcessManager(); | |
| 520 system->process_manager()->SetRenderProcessHostFactoryForTest(&rph_factory_); | |
| 514 } | 521 } |
| 515 | 522 |
| 516 void ExtensionServiceTestBase::InitializeExtensionServiceWithUpdater() { | 523 void ExtensionServiceTestBase::InitializeExtensionServiceWithUpdater() { |
| 517 InitializeExtensionServiceHelper(true); | 524 InitializeExtensionServiceHelper(true); |
| 518 service_->updater()->Start(); | 525 service_->updater()->Start(); |
| 519 } | 526 } |
| 520 | 527 |
| 521 void ExtensionServiceTestBase::InitializeExtensionServiceHelper( | 528 void ExtensionServiceTestBase::InitializeExtensionServiceHelper( |
| 522 bool autoupdate_enabled) { | 529 bool autoupdate_enabled) { |
| 523 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 530 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| (...skipping 3081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3605 // EnableExtension() call above inserted into it and | 3612 // EnableExtension() call above inserted into it and |
| 3606 // UnloadAllExtensions() doesn't send out notifications. | 3613 // UnloadAllExtensions() doesn't send out notifications. |
| 3607 loaded_.clear(); | 3614 loaded_.clear(); |
| 3608 service_->ReloadExtensions(); | 3615 service_->ReloadExtensions(); |
| 3609 | 3616 |
| 3610 // Extension counts shouldn't change. | 3617 // Extension counts shouldn't change. |
| 3611 EXPECT_EQ(1u, service_->extensions()->size()); | 3618 EXPECT_EQ(1u, service_->extensions()->size()); |
| 3612 EXPECT_EQ(0u, service_->disabled_extensions()->size()); | 3619 EXPECT_EQ(0u, service_->disabled_extensions()->size()); |
| 3613 } | 3620 } |
| 3614 | 3621 |
| 3622 std::vector<uint32> MessageTypes(const IPC::TestSink& sink) { | |
| 3623 std::vector<uint32> message_types; | |
| 3624 for (size_t i = 0; i < sink.message_count(); ++i) { | |
| 3625 message_types.push_back(sink.GetMessageAt(i)->type()); | |
| 3626 } | |
| 3627 return message_types; | |
| 3628 } | |
| 3629 | |
| 3630 struct ProcessObserver | |
| 3631 : public content::MockRenderProcessHostFactory::Observer { | |
| 3632 explicit ProcessObserver(content::MockRenderProcessHostFactory* factory) | |
| 3633 : Observer(factory) {} | |
| 3634 | |
| 3635 ~ProcessObserver() { | |
| 3636 for (size_t i = 0; i < hosts.size(); ++i) { | |
| 3637 if (destroyed_processes.count(process_ids[i]) == 0) | |
| 3638 hosts[i]->sink().RemoveFilter(process_messages[i]); | |
| 3639 delete process_messages[i]; | |
| 3640 } | |
| 3641 } | |
| 3642 | |
| 3643 virtual void OnRenderProcessHostCreated( | |
| 3644 content::MockRenderProcessHost* host) { | |
| 3645 IPC::TestSink* sink = new IPC::TestSink; | |
| 3646 hosts.push_back(host); | |
| 3647 process_ids.push_back(host->GetID()); | |
| 3648 process_messages.push_back(sink); | |
| 3649 host->sink().AddFilter(sink); | |
| 3650 } | |
| 3651 virtual void OnRenderProcessHostDestroyed( | |
| 3652 content::MockRenderProcessHost* host) { | |
| 3653 destroyed_processes.insert(host->GetID()); | |
| 3654 } | |
| 3655 | |
| 3656 std::vector<content::MockRenderProcessHost*> hosts; | |
| 3657 std::vector<int> process_ids; | |
| 3658 std::vector<IPC::TestSink*> process_messages; | |
| 3659 std::set<int> destroyed_processes; | |
| 3660 }; | |
| 3661 | |
| 3615 // Tests reloading an extension. | 3662 // Tests reloading an extension. |
| 3616 TEST_F(ExtensionServiceTest, ReloadExtension) { | 3663 TEST_F(ExtensionServiceTest, ReloadExtension) { |
| 3664 ProcessObserver observer(&rph_factory_); | |
| 3665 | |
| 3666 content::TestNotificationTracker notifications; | |
| 3667 notifications.ListenForAll(chrome::NOTIFICATION_EXTENSIONS_READY); | |
|
Jeffrey Yasskin
2013/04/04 09:34:35
I think it makes a lot of sense to assert against
Matt Perry
2013/04/04 20:54:26
Yeah, I really like testing for notifications and
| |
| 3668 notifications.ListenForAll(chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED); | |
| 3669 notifications.ListenForAll(chrome::NOTIFICATION_EXTENSION_LOADED); | |
| 3670 notifications.ListenForAll(chrome::NOTIFICATION_EXTENSION_UNLOADED); | |
| 3671 notifications.ListenForAll(content::NOTIFICATION_RENDERER_PROCESS_CLOSING); | |
| 3672 notifications.ListenForAll(content::NOTIFICATION_RENDERER_PROCESS_CREATED); | |
| 3673 notifications.ListenForAll(content::NOTIFICATION_RENDERER_PROCESS_TERMINATED); | |
| 3674 notifications.ListenForAll( | |
| 3675 content::NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW); | |
| 3676 | |
| 3617 InitializeEmptyExtensionService(); | 3677 InitializeEmptyExtensionService(); |
| 3618 InitializeExtensionProcessManager(); | 3678 InitializeExtensionProcessManager(); |
| 3679 service_->Init(); | |
|
Matt Perry
2013/04/04 20:54:26
So this test used to work without ever calling Ini
Jeffrey Yasskin
2013/04/05 13:14:01
Yep. I it required the omission, or else it hit th
| |
| 3680 EXPECT_THAT(notifications.GetTypesAndReset(), | |
| 3681 testing::ElementsAre(chrome::NOTIFICATION_EXTENSIONS_READY)); | |
| 3619 | 3682 |
| 3620 // Simple extension that should install without error. | 3683 // Simple extension that should install without error. |
| 3621 const char* extension_id = "behllobkkfkfnphdnhnkndlbkcpglgmj"; | 3684 const char* extension_id = "behllobkkfkfnphdnhnkndlbkcpglgmj"; |
| 3622 base::FilePath ext = data_dir_ | 3685 base::FilePath ext = data_dir_ |
| 3623 .AppendASCII("good") | 3686 .AppendASCII("good") |
| 3624 .AppendASCII("Extensions") | 3687 .AppendASCII("Extensions") |
| 3625 .AppendASCII(extension_id) | 3688 .AppendASCII(extension_id) |
| 3626 .AppendASCII("1.0.0.0"); | 3689 .AppendASCII("1.0.0.0"); |
| 3627 extensions::UnpackedInstaller::Create(service_)->Load(ext); | 3690 extensions::UnpackedInstaller::Create(service_)->Load(ext); |
| 3628 loop_.RunUntilIdle(); | 3691 loop_.RunUntilIdle(); |
| 3629 | 3692 |
| 3693 EXPECT_THAT(notifications.GetTypesAndReset(), | |
| 3694 testing::ElementsAre(chrome::NOTIFICATION_EXTENSION_LOADED)); | |
| 3695 ASSERT_EQ(1u, observer.process_messages.size()); | |
| 3696 { | |
| 3697 testing::Matcher<uint32> expected_types[] = { | |
|
Jeffrey Yasskin
2013/04/04 09:34:35
The long lists of notifications and message types
Matt Perry
2013/04/04 20:54:26
Some messages we probably don't care about. Might
Jeffrey Yasskin
2013/04/05 13:14:01
That's not quite right, since we want to assert th
| |
| 3698 ExtensionMsg_Loaded::ID, | |
| 3699 ExtensionMsg_ActivateExtension::ID, | |
| 3700 ExtensionMsg_Loaded::ID, | |
|
Jeffrey Yasskin
2013/04/04 09:34:35
Why do we send Loaded/ActivateExtension 3 times? P
Matt Perry
2013/04/04 20:54:26
Yikes! Good find.
| |
| 3701 ExtensionMsg_ActivateExtension::ID, | |
| 3702 testing::_, // ViewMsg_New::ID, | |
|
Jeffrey Yasskin
2013/04/04 09:34:35
DEPS prevents me from #including content/common/vi
| |
| 3703 testing::_, // ViewMsg_AllowBindings::ID, | |
| 3704 ExtensionMsg_Loaded::ID, | |
| 3705 ExtensionMsg_ActivateExtension::ID, | |
| 3706 ExtensionMsg_NotifyRenderViewType::ID, | |
| 3707 testing::_, // ViewMsg_Close::ID, | |
| 3708 testing::_, // ViewMsg_Navigate::ID | |
| 3709 }; | |
| 3710 IPC::TestSink& sink = *observer.process_messages[0]; | |
| 3711 EXPECT_THAT(MessageTypes(sink), testing::ElementsAreArray(expected_types)); | |
| 3712 sink.ClearMessages(); | |
| 3713 } | |
| 3714 | |
| 3630 EXPECT_EQ(1u, service_->extensions()->size()); | 3715 EXPECT_EQ(1u, service_->extensions()->size()); |
| 3631 EXPECT_EQ(0u, service_->disabled_extensions()->size()); | 3716 EXPECT_EQ(0u, service_->disabled_extensions()->size()); |
| 3632 | 3717 |
| 3633 service_->ReloadExtension(extension_id); | 3718 service_->ReloadExtension(extension_id); |
| 3634 | 3719 |
| 3720 EXPECT_THAT(notifications.GetTypesAndReset(), | |
| 3721 testing::ElementsAre( | |
| 3722 chrome::NOTIFICATION_EXTENSION_UNLOADED, | |
| 3723 content::NOTIFICATION_RENDERER_PROCESS_CLOSING, | |
| 3724 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | |
| 3725 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED)); | |
| 3726 | |
| 3727 ASSERT_EQ(1u, observer.process_messages.size()); | |
| 3728 EXPECT_THAT(MessageTypes(*observer.process_messages[0]), | |
| 3729 testing::ElementsAre(testing::_ /*ViewMsg_Close::ID*/)); | |
| 3730 observer.process_messages[0]->ClearMessages(); | |
| 3731 | |
| 3635 // Extension should be disabled now, waiting to be reloaded. | 3732 // Extension should be disabled now, waiting to be reloaded. |
| 3636 EXPECT_EQ(0u, service_->extensions()->size()); | 3733 EXPECT_EQ(0u, service_->extensions()->size()); |
| 3637 EXPECT_EQ(1u, service_->disabled_extensions()->size()); | 3734 EXPECT_EQ(1u, service_->disabled_extensions()->size()); |
| 3638 EXPECT_EQ(Extension::DISABLE_RELOAD, | 3735 EXPECT_EQ(Extension::DISABLE_RELOAD, |
| 3639 service_->extension_prefs()->GetDisableReasons(extension_id)); | 3736 service_->extension_prefs()->GetDisableReasons(extension_id)); |
| 3640 | 3737 |
| 3641 // Reloading again should not crash. | 3738 // Reloading again before iterating the MessageLoop should not crash and |
| 3739 // shouldn't cause an extra reload. | |
|
Matt Perry
2013/04/04 20:54:26
I'm not sure I agree with the second half. It make
Jeffrey Yasskin
2013/04/05 13:14:01
I think that would be plausible behavior, but it w
| |
| 3642 service_->ReloadExtension(extension_id); | 3740 service_->ReloadExtension(extension_id); |
|
Jeffrey Yasskin
2013/04/04 09:34:35
Commenting this line out has no effect on the test
| |
| 3741 EXPECT_THAT(notifications.GetTypesAndReset(), | |
| 3742 testing::ElementsAre()); | |
| 3743 ASSERT_EQ(1u, observer.process_messages.size()); | |
| 3744 EXPECT_THAT(MessageTypes(*observer.process_messages[0]), | |
| 3745 testing::ElementsAre()); | |
| 3746 observer.process_messages[0]->ClearMessages(); | |
| 3643 | 3747 |
| 3644 // Finish reloading | 3748 // Finish reloading |
| 3645 loop_.RunUntilIdle(); | 3749 loop_.RunUntilIdle(); |
| 3646 | 3750 |
| 3751 EXPECT_THAT(notifications.GetTypesAndReset(), | |
| 3752 testing::ElementsAre( | |
| 3753 chrome::NOTIFICATION_EXTENSION_LOADED, | |
| 3754 chrome::NOTIFICATION_EXTENSION_UNLOADED, | |
|
Jeffrey Yasskin
2013/04/04 09:34:35
Note the extra reload here.
| |
| 3755 content::NOTIFICATION_RENDERER_PROCESS_CLOSING, | |
| 3756 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | |
| 3757 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | |
| 3758 chrome::NOTIFICATION_EXTENSION_LOADED)); | |
| 3759 | |
| 3760 ASSERT_EQ(3u, observer.process_messages.size()); | |
|
Jeffrey Yasskin
2013/04/04 09:34:35
This should become "2" when I fix the extra-reload
| |
| 3761 EXPECT_THAT(observer.destroyed_processes, | |
| 3762 testing::ElementsAre(observer.process_ids[0], | |
| 3763 observer.process_ids[1])); | |
| 3764 EXPECT_THAT(MessageTypes(*observer.process_messages[0]), | |
| 3765 testing::ElementsAre()); | |
| 3766 observer.process_messages[0]->ClearMessages(); | |
| 3767 { | |
| 3768 testing::Matcher<uint32> expected_types[] = { | |
| 3769 ExtensionMsg_Loaded::ID, | |
| 3770 ExtensionMsg_ActivateExtension::ID, | |
| 3771 ExtensionMsg_Loaded::ID, | |
| 3772 ExtensionMsg_ActivateExtension::ID, | |
| 3773 testing::_, // ViewMsg_New::ID, | |
| 3774 testing::_, // ViewMsg_AllowBindings::ID, | |
| 3775 ExtensionMsg_Loaded::ID, | |
| 3776 ExtensionMsg_ActivateExtension::ID, | |
| 3777 ExtensionMsg_NotifyRenderViewType::ID, | |
| 3778 testing::_, // ViewMsg_Close::ID, | |
| 3779 testing::_, // ViewMsg_Navigate::ID, | |
| 3780 testing::_, // ViewMsg_Close::ID | |
| 3781 }; | |
| 3782 EXPECT_THAT(MessageTypes(*observer.process_messages[1]), | |
| 3783 testing::ElementsAreArray(expected_types)); | |
| 3784 observer.process_messages[1]->ClearMessages(); | |
| 3785 } | |
| 3786 { | |
| 3787 testing::Matcher<uint32> expected_types[] = { | |
| 3788 ExtensionMsg_Loaded::ID, | |
| 3789 ExtensionMsg_ActivateExtension::ID, | |
| 3790 ExtensionMsg_Loaded::ID, | |
| 3791 ExtensionMsg_ActivateExtension::ID, | |
| 3792 testing::_, // ViewMsg_New::ID | |
| 3793 testing::_, // ViewMsg_AllowBindings::ID, | |
| 3794 ExtensionMsg_Loaded::ID, | |
| 3795 ExtensionMsg_ActivateExtension::ID, | |
| 3796 ExtensionMsg_NotifyRenderViewType::ID, | |
| 3797 testing::_, // ViewMsg_Close::ID, | |
| 3798 testing::_, // ViewMsg_Navigate::ID | |
| 3799 }; | |
| 3800 EXPECT_THAT(MessageTypes(*observer.process_messages[2]), | |
| 3801 testing::ElementsAreArray(expected_types)); | |
| 3802 observer.process_messages[2]->ClearMessages(); | |
| 3803 } | |
| 3804 | |
| 3647 // Extension should be enabled again. | 3805 // Extension should be enabled again. |
| 3648 EXPECT_EQ(1u, service_->extensions()->size()); | 3806 EXPECT_EQ(1u, service_->extensions()->size()); |
| 3649 EXPECT_EQ(0u, service_->disabled_extensions()->size()); | 3807 EXPECT_EQ(0u, service_->disabled_extensions()->size()); |
| 3650 } | 3808 } |
| 3651 | 3809 |
| 3652 TEST_F(ExtensionServiceTest, UninstallExtension) { | 3810 TEST_F(ExtensionServiceTest, UninstallExtension) { |
| 3653 InitializeEmptyExtensionService(); | 3811 InitializeEmptyExtensionService(); |
| 3654 InstallCRX(data_dir_.AppendASCII("good.crx"), INSTALL_NEW); | 3812 InstallCRX(data_dir_.AppendASCII("good.crx"), INSTALL_NEW); |
| 3655 EXPECT_EQ(1u, service_->extensions()->size()); | 3813 EXPECT_EQ(1u, service_->extensions()->size()); |
| 3656 UninstallExtension(good_crx, false); | 3814 UninstallExtension(good_crx, false); |
| (...skipping 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5906 EXPECT_FALSE(extensions::HasExternalInstallError(service_)); | 6064 EXPECT_FALSE(extensions::HasExternalInstallError(service_)); |
| 5907 EXPECT_FALSE(service_->IsExtensionEnabled(good_crx)); | 6065 EXPECT_FALSE(service_->IsExtensionEnabled(good_crx)); |
| 5908 EXPECT_TRUE(service_->IsExtensionEnabled(page_action)); | 6066 EXPECT_TRUE(service_->IsExtensionEnabled(page_action)); |
| 5909 | 6067 |
| 5910 ExtensionPrefs* prefs = service_->extension_prefs(); | 6068 ExtensionPrefs* prefs = service_->extension_prefs(); |
| 5911 EXPECT_NE(0, prefs->GetDisableReasons(good_crx) & | 6069 EXPECT_NE(0, prefs->GetDisableReasons(good_crx) & |
| 5912 Extension::DISABLE_SIDELOAD_WIPEOUT); | 6070 Extension::DISABLE_SIDELOAD_WIPEOUT); |
| 5913 EXPECT_EQ(0, prefs->GetDisableReasons(page_action) & | 6071 EXPECT_EQ(0, prefs->GetDisableReasons(page_action) & |
| 5914 Extension::DISABLE_SIDELOAD_WIPEOUT); | 6072 Extension::DISABLE_SIDELOAD_WIPEOUT); |
| 5915 } | 6073 } |
| OLD | NEW |