| 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 "base/run_loop.h" |
| 8 #include "content/public/test/test_browser_thread.h" | 9 #include "content/public/test/test_browser_thread.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 11 |
| 11 using content::BrowserThread; | 12 using content::BrowserThread; |
| 12 | 13 |
| 13 class FakeExternalProtocolHandlerWorker | 14 class FakeExternalProtocolHandlerWorker |
| 14 : public shell_integration::DefaultProtocolClientWorker { | 15 : public shell_integration::DefaultProtocolClientWorker { |
| 15 public: | 16 public: |
| 16 FakeExternalProtocolHandlerWorker( | 17 FakeExternalProtocolHandlerWorker( |
| 17 const shell_integration::DefaultWebClientWorkerCallback& callback, | 18 const shell_integration::DefaultWebClientWorkerCallback& callback, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 GURL url("mailto:test@test.com"); | 124 GURL url("mailto:test@test.com"); |
| 124 ASSERT_FALSE(delegate_.has_prompted()); | 125 ASSERT_FALSE(delegate_.has_prompted()); |
| 125 ASSERT_FALSE(delegate_.has_launched()); | 126 ASSERT_FALSE(delegate_.has_launched()); |
| 126 ASSERT_FALSE(delegate_.has_blocked()); | 127 ASSERT_FALSE(delegate_.has_blocked()); |
| 127 | 128 |
| 128 delegate_.set_block_state(block_state); | 129 delegate_.set_block_state(block_state); |
| 129 delegate_.set_os_state(os_state); | 130 delegate_.set_os_state(os_state); |
| 130 ExternalProtocolHandler::LaunchUrlWithDelegate( | 131 ExternalProtocolHandler::LaunchUrlWithDelegate( |
| 131 url, 0, 0, ui::PAGE_TRANSITION_LINK, true, &delegate_); | 132 url, 0, 0, ui::PAGE_TRANSITION_LINK, true, &delegate_); |
| 132 if (block_state != ExternalProtocolHandler::BLOCK) | 133 if (block_state != ExternalProtocolHandler::BLOCK) |
| 133 base::MessageLoop::current()->Run(); | 134 base::RunLoop().Run(); |
| 134 | 135 |
| 135 ASSERT_EQ(should_prompt, delegate_.has_prompted()); | 136 ASSERT_EQ(should_prompt, delegate_.has_prompted()); |
| 136 ASSERT_EQ(should_launch, delegate_.has_launched()); | 137 ASSERT_EQ(should_launch, delegate_.has_launched()); |
| 137 ASSERT_EQ(should_block, delegate_.has_blocked()); | 138 ASSERT_EQ(should_block, delegate_.has_blocked()); |
| 138 } | 139 } |
| 139 | 140 |
| 140 base::MessageLoopForUI ui_message_loop_; | 141 base::MessageLoopForUI ui_message_loop_; |
| 141 content::TestBrowserThread ui_thread_; | 142 content::TestBrowserThread ui_thread_; |
| 142 content::TestBrowserThread file_thread_; | 143 content::TestBrowserThread file_thread_; |
| 143 | 144 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 182 |
| 182 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeNotDefault) { | 183 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeNotDefault) { |
| 183 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::NOT_DEFAULT, true, | 184 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::NOT_DEFAULT, true, |
| 184 false, false); | 185 false, false); |
| 185 } | 186 } |
| 186 | 187 |
| 187 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) { | 188 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) { |
| 188 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::UNKNOWN_DEFAULT, | 189 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::UNKNOWN_DEFAULT, |
| 189 true, false, false); | 190 true, false, false); |
| 190 } | 191 } |
| OLD | NEW |