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 |
11 using content::BrowserThread; | 11 using content::BrowserThread; |
12 | 12 |
13 class FakeExternalProtocolHandlerWorker | 13 class FakeExternalProtocolHandlerWorker |
14 : public shell_integration::DefaultProtocolClientWorker { | 14 : public shell_integration::DefaultProtocolClientWorker { |
15 public: | 15 public: |
16 FakeExternalProtocolHandlerWorker( | 16 FakeExternalProtocolHandlerWorker( |
17 const shell_integration::DefaultWebClientWorkerCallback& callback, | 17 const shell_integration::DefaultWebClientWorkerCallback& callback, |
18 const std::string& protocol, | 18 const std::string& protocol, |
19 shell_integration::DefaultWebClientState os_state) | 19 shell_integration::DefaultWebClientState os_state) |
20 : shell_integration::DefaultProtocolClientWorker(callback, protocol), | 20 : shell_integration::DefaultProtocolClientWorker(callback, protocol), |
21 os_state_(os_state) {} | 21 os_state_(os_state) {} |
22 | 22 |
23 private: | 23 private: |
24 ~FakeExternalProtocolHandlerWorker() override = default; | 24 ~FakeExternalProtocolHandlerWorker() override = default; |
25 | 25 |
26 shell_integration::DefaultWebClientState CheckIsDefaultImpl() override { | 26 shell_integration::DefaultWebClientState CheckIsDefaultImpl() override { |
27 return os_state_; | 27 return os_state_; |
28 } | 28 } |
29 | 29 |
30 void SetAsDefaultImpl() override {} | 30 void SetAsDefaultImpl(const base::Closure& on_finished_callback) override { |
| 31 on_finished_callback.Run(); |
| 32 } |
31 | 33 |
32 shell_integration::DefaultWebClientState os_state_; | 34 shell_integration::DefaultWebClientState os_state_; |
33 }; | 35 }; |
34 | 36 |
35 class FakeExternalProtocolHandlerDelegate | 37 class FakeExternalProtocolHandlerDelegate |
36 : public ExternalProtocolHandler::Delegate { | 38 : public ExternalProtocolHandler::Delegate { |
37 public: | 39 public: |
38 FakeExternalProtocolHandlerDelegate() | 40 FakeExternalProtocolHandlerDelegate() |
39 : block_state_(ExternalProtocolHandler::BLOCK), | 41 : block_state_(ExternalProtocolHandler::BLOCK), |
40 os_state_(shell_integration::UNKNOWN_DEFAULT), | 42 os_state_(shell_integration::UNKNOWN_DEFAULT), |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 181 |
180 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeNotDefault) { | 182 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeNotDefault) { |
181 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::NOT_DEFAULT, true, | 183 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::NOT_DEFAULT, true, |
182 false, false); | 184 false, false); |
183 } | 185 } |
184 | 186 |
185 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) { | 187 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) { |
186 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::UNKNOWN_DEFAULT, | 188 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::UNKNOWN_DEFAULT, |
187 true, false, false); | 189 true, false, false); |
188 } | 190 } |
OLD | NEW |