| 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/external_protocol/external_protocol_handler.h" | 5 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
| 6 | 6 |
| 7 #include "content/browser/browser_thread.h" | 7 #include "content/test/test_browser_thread.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 class FakeExternalProtocolHandlerWorker | 10 class FakeExternalProtocolHandlerWorker |
| 11 : public ShellIntegration::DefaultProtocolClientWorker { | 11 : public ShellIntegration::DefaultProtocolClientWorker { |
| 12 public: | 12 public: |
| 13 FakeExternalProtocolHandlerWorker( | 13 FakeExternalProtocolHandlerWorker( |
| 14 ShellIntegration::DefaultWebClientObserver* observer, | 14 ShellIntegration::DefaultWebClientObserver* observer, |
| 15 const std::string& protocol, | 15 const std::string& protocol, |
| 16 ShellIntegration::DefaultWebClientState os_state) | 16 ShellIntegration::DefaultWebClientState os_state) |
| 17 : ShellIntegration::DefaultProtocolClientWorker(observer, protocol), | 17 : ShellIntegration::DefaultProtocolClientWorker(observer, protocol), |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 ExternalProtocolHandler::LaunchUrlWithDelegate(url, 0, 0, &delegate_); | 115 ExternalProtocolHandler::LaunchUrlWithDelegate(url, 0, 0, &delegate_); |
| 116 if (block_state != ExternalProtocolHandler::BLOCK) | 116 if (block_state != ExternalProtocolHandler::BLOCK) |
| 117 MessageLoop::current()->Run(); | 117 MessageLoop::current()->Run(); |
| 118 | 118 |
| 119 ASSERT_EQ(should_prompt, delegate_.has_prompted()); | 119 ASSERT_EQ(should_prompt, delegate_.has_prompted()); |
| 120 ASSERT_EQ(should_launch, delegate_.has_launched()); | 120 ASSERT_EQ(should_launch, delegate_.has_launched()); |
| 121 ASSERT_EQ(should_block, delegate_.has_blocked()); | 121 ASSERT_EQ(should_block, delegate_.has_blocked()); |
| 122 } | 122 } |
| 123 | 123 |
| 124 MessageLoopForUI ui_message_loop_; | 124 MessageLoopForUI ui_message_loop_; |
| 125 BrowserThread ui_thread_; | 125 content::TestBrowserThread ui_thread_; |
| 126 BrowserThread file_thread_; | 126 content::TestBrowserThread file_thread_; |
| 127 | 127 |
| 128 FakeExternalProtocolHandlerDelegate delegate_; | 128 FakeExternalProtocolHandlerDelegate delegate_; |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeBlockedChromeDefault) { | 131 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeBlockedChromeDefault) { |
| 132 DoTest(ExternalProtocolHandler::BLOCK, | 132 DoTest(ExternalProtocolHandler::BLOCK, |
| 133 ShellIntegration::IS_DEFAULT_WEB_CLIENT, | 133 ShellIntegration::IS_DEFAULT_WEB_CLIENT, |
| 134 false, false, true); | 134 false, false, true); |
| 135 } | 135 } |
| 136 | 136 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 DoTest(ExternalProtocolHandler::UNKNOWN, | 174 DoTest(ExternalProtocolHandler::UNKNOWN, |
| 175 ShellIntegration::NOT_DEFAULT_WEB_CLIENT, | 175 ShellIntegration::NOT_DEFAULT_WEB_CLIENT, |
| 176 true, false, false); | 176 true, false, false); |
| 177 } | 177 } |
| 178 | 178 |
| 179 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) { | 179 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) { |
| 180 DoTest(ExternalProtocolHandler::UNKNOWN, | 180 DoTest(ExternalProtocolHandler::UNKNOWN, |
| 181 ShellIntegration::UNKNOWN_DEFAULT_WEB_CLIENT, | 181 ShellIntegration::UNKNOWN_DEFAULT_WEB_CLIENT, |
| 182 true, false, false); | 182 true, false, false); |
| 183 } | 183 } |
| OLD | NEW |