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/test/test_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 using content::BrowserThread; | 10 using content::BrowserThread; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 class ExternalProtocolHandlerTest : public testing::Test { | 95 class ExternalProtocolHandlerTest : public testing::Test { |
96 protected: | 96 protected: |
97 ExternalProtocolHandlerTest() | 97 ExternalProtocolHandlerTest() |
98 : ui_thread_(BrowserThread::UI, MessageLoop::current()), | 98 : ui_thread_(BrowserThread::UI, MessageLoop::current()), |
99 file_thread_(BrowserThread::FILE) {} | 99 file_thread_(BrowserThread::FILE) {} |
100 | 100 |
101 virtual void SetUp() { | 101 virtual void SetUp() { |
102 file_thread_.Start(); | 102 file_thread_.Start(); |
103 } | 103 } |
104 | 104 |
| 105 virtual void TearDown() { |
| 106 // Ensure that g_accept_requests gets set back to true after test execution. |
| 107 ExternalProtocolHandler::PermitLaunchUrl(); |
| 108 } |
| 109 |
105 void DoTest(ExternalProtocolHandler::BlockState block_state, | 110 void DoTest(ExternalProtocolHandler::BlockState block_state, |
106 ShellIntegration::DefaultWebClientState os_state, | 111 ShellIntegration::DefaultWebClientState os_state, |
107 bool should_prompt, bool should_launch, bool should_block) { | 112 bool should_prompt, bool should_launch, bool should_block) { |
108 GURL url("mailto:test@test.com"); | 113 GURL url("mailto:test@test.com"); |
109 ASSERT_FALSE(delegate_.has_prompted()); | 114 ASSERT_FALSE(delegate_.has_prompted()); |
110 ASSERT_FALSE(delegate_.has_launched()); | 115 ASSERT_FALSE(delegate_.has_launched()); |
111 ASSERT_FALSE(delegate_.has_blocked()); | 116 ASSERT_FALSE(delegate_.has_blocked()); |
112 | 117 |
113 delegate_.set_block_state(block_state); | 118 delegate_.set_block_state(block_state); |
114 delegate_.set_os_state(os_state); | 119 delegate_.set_os_state(os_state); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 DoTest(ExternalProtocolHandler::UNKNOWN, | 179 DoTest(ExternalProtocolHandler::UNKNOWN, |
175 ShellIntegration::NOT_DEFAULT_WEB_CLIENT, | 180 ShellIntegration::NOT_DEFAULT_WEB_CLIENT, |
176 true, false, false); | 181 true, false, false); |
177 } | 182 } |
178 | 183 |
179 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) { | 184 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) { |
180 DoTest(ExternalProtocolHandler::UNKNOWN, | 185 DoTest(ExternalProtocolHandler::UNKNOWN, |
181 ShellIntegration::UNKNOWN_DEFAULT_WEB_CLIENT, | 186 ShellIntegration::UNKNOWN_DEFAULT_WEB_CLIENT, |
182 true, false, false); | 187 true, false, false); |
183 } | 188 } |
OLD | NEW |