| 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 "base/auto_reset.h" | 5 #include "base/auto_reset.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 10 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 10 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 EXPECT_FALSE(bubble_content.radio_group.radio_items.empty()); | 807 EXPECT_FALSE(bubble_content.radio_group.radio_items.empty()); |
| 808 EXPECT_TRUE(bubble_content.popup_items.empty()); | 808 EXPECT_TRUE(bubble_content.popup_items.empty()); |
| 809 EXPECT_TRUE(bubble_content.domain_lists.empty()); | 809 EXPECT_TRUE(bubble_content.domain_lists.empty()); |
| 810 EXPECT_TRUE(bubble_content.custom_link.empty()); | 810 EXPECT_TRUE(bubble_content.custom_link.empty()); |
| 811 EXPECT_FALSE(bubble_content.custom_link_enabled); | 811 EXPECT_FALSE(bubble_content.custom_link_enabled); |
| 812 EXPECT_FALSE(bubble_content.manage_link.empty()); | 812 EXPECT_FALSE(bubble_content.manage_link.empty()); |
| 813 } | 813 } |
| 814 | 814 |
| 815 class FakeDelegate : public ProtocolHandlerRegistry::Delegate { | 815 class FakeDelegate : public ProtocolHandlerRegistry::Delegate { |
| 816 public: | 816 public: |
| 817 virtual void RegisterExternalHandler(const std::string& protocol) override { | 817 void RegisterExternalHandler(const std::string& protocol) override { |
| 818 // Overrides in order to not register the handler with the | 818 // Overrides in order to not register the handler with the |
| 819 // ChildProcessSecurityPolicy. That has persistent and unalterable | 819 // ChildProcessSecurityPolicy. That has persistent and unalterable |
| 820 // side effects on other tests. | 820 // side effects on other tests. |
| 821 } | 821 } |
| 822 | 822 |
| 823 virtual ShellIntegration::DefaultProtocolClientWorker* CreateShellWorker( | 823 ShellIntegration::DefaultProtocolClientWorker* CreateShellWorker( |
| 824 ShellIntegration::DefaultWebClientObserver* observer, | 824 ShellIntegration::DefaultWebClientObserver* observer, |
| 825 const std::string& protocol) override { | 825 const std::string& protocol) override { |
| 826 VLOG(1) << "CreateShellWorker"; | 826 VLOG(1) << "CreateShellWorker"; |
| 827 return NULL; | 827 return NULL; |
| 828 } | 828 } |
| 829 | 829 |
| 830 virtual ProtocolHandlerRegistry::DefaultClientObserver* CreateShellObserver( | 830 ProtocolHandlerRegistry::DefaultClientObserver* CreateShellObserver( |
| 831 ProtocolHandlerRegistry* registry) override { | 831 ProtocolHandlerRegistry* registry) override { |
| 832 return NULL; | 832 return NULL; |
| 833 } | 833 } |
| 834 | 834 |
| 835 virtual void RegisterWithOSAsDefaultClient( | 835 void RegisterWithOSAsDefaultClient( |
| 836 const std::string& protocol, | 836 const std::string& protocol, |
| 837 ProtocolHandlerRegistry* registry) override { | 837 ProtocolHandlerRegistry* registry) override { |
| 838 VLOG(1) << "Register With OS"; | 838 VLOG(1) << "Register With OS"; |
| 839 } | 839 } |
| 840 }; | 840 }; |
| 841 | 841 |
| 842 TEST_F(ContentSettingBubbleModelTest, RPHAllow) { | 842 TEST_F(ContentSettingBubbleModelTest, RPHAllow) { |
| 843 ProtocolHandlerRegistry registry(profile(), new FakeDelegate()); | 843 ProtocolHandlerRegistry registry(profile(), new FakeDelegate()); |
| 844 registry.InitProtocolSettings(); | 844 registry.InitProtocolSettings(); |
| 845 | 845 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 { | 895 { |
| 896 ProtocolHandler handler = registry.GetHandlerFor("mailto"); | 896 ProtocolHandler handler = registry.GetHandlerFor("mailto"); |
| 897 ASSERT_FALSE(handler.IsEmpty()); | 897 ASSERT_FALSE(handler.IsEmpty()); |
| 898 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 898 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 899 content_settings->pending_protocol_handler_setting()); | 899 content_settings->pending_protocol_handler_setting()); |
| 900 EXPECT_FALSE(registry.IsIgnored(test_handler)); | 900 EXPECT_FALSE(registry.IsIgnored(test_handler)); |
| 901 } | 901 } |
| 902 | 902 |
| 903 registry.Shutdown(); | 903 registry.Shutdown(); |
| 904 } | 904 } |
| OLD | NEW |