| 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 "chrome/browser/external_protocol/external_protocol_handler.h" | 5 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "content/public/test/test_browser_thread.h" | 8 #include "content/public/test/test_browser_thread.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 bool has_prompted_; | 96 bool has_prompted_; |
| 97 bool has_blocked_; | 97 bool has_blocked_; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 class ExternalProtocolHandlerTest : public testing::Test { | 100 class ExternalProtocolHandlerTest : public testing::Test { |
| 101 protected: | 101 protected: |
| 102 ExternalProtocolHandlerTest() | 102 ExternalProtocolHandlerTest() |
| 103 : ui_thread_(BrowserThread::UI, base::MessageLoop::current()), | 103 : ui_thread_(BrowserThread::UI, base::MessageLoop::current()), |
| 104 file_thread_(BrowserThread::FILE) {} | 104 file_thread_(BrowserThread::FILE) {} |
| 105 | 105 |
| 106 virtual void SetUp() { | 106 void SetUp() override { file_thread_.Start(); } |
| 107 file_thread_.Start(); | |
| 108 } | |
| 109 | 107 |
| 110 virtual void TearDown() { | 108 void TearDown() override { |
| 111 // Ensure that g_accept_requests gets set back to true after test execution. | 109 // Ensure that g_accept_requests gets set back to true after test execution. |
| 112 ExternalProtocolHandler::PermitLaunchUrl(); | 110 ExternalProtocolHandler::PermitLaunchUrl(); |
| 113 } | 111 } |
| 114 | 112 |
| 115 void DoTest(ExternalProtocolHandler::BlockState block_state, | 113 void DoTest(ExternalProtocolHandler::BlockState block_state, |
| 116 ShellIntegration::DefaultWebClientState os_state, | 114 ShellIntegration::DefaultWebClientState os_state, |
| 117 bool should_prompt, bool should_launch, bool should_block) { | 115 bool should_prompt, bool should_launch, bool should_block) { |
| 118 GURL url("mailto:test@test.com"); | 116 GURL url("mailto:test@test.com"); |
| 119 ASSERT_FALSE(delegate_.has_prompted()); | 117 ASSERT_FALSE(delegate_.has_prompted()); |
| 120 ASSERT_FALSE(delegate_.has_launched()); | 118 ASSERT_FALSE(delegate_.has_launched()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 DoTest(ExternalProtocolHandler::UNKNOWN, | 182 DoTest(ExternalProtocolHandler::UNKNOWN, |
| 185 ShellIntegration::NOT_DEFAULT, | 183 ShellIntegration::NOT_DEFAULT, |
| 186 true, false, false); | 184 true, false, false); |
| 187 } | 185 } |
| 188 | 186 |
| 189 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) { | 187 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) { |
| 190 DoTest(ExternalProtocolHandler::UNKNOWN, | 188 DoTest(ExternalProtocolHandler::UNKNOWN, |
| 191 ShellIntegration::UNKNOWN_DEFAULT, | 189 ShellIntegration::UNKNOWN_DEFAULT, |
| 192 true, false, false); | 190 true, false, false); |
| 193 } | 191 } |
| OLD | NEW |