| 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 AttemptResult SetAsDefaultImpl() override { return AttemptResult::SUCCESS; } | 30 void SetAsDefaultImpl() override {} |
| 31 | 31 |
| 32 shell_integration::DefaultWebClientState os_state_; | 32 shell_integration::DefaultWebClientState os_state_; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 class FakeExternalProtocolHandlerDelegate | 35 class FakeExternalProtocolHandlerDelegate |
| 36 : public ExternalProtocolHandler::Delegate { | 36 : public ExternalProtocolHandler::Delegate { |
| 37 public: | 37 public: |
| 38 FakeExternalProtocolHandlerDelegate() | 38 FakeExternalProtocolHandlerDelegate() |
| 39 : block_state_(ExternalProtocolHandler::BLOCK), | 39 : block_state_(ExternalProtocolHandler::BLOCK), |
| 40 os_state_(shell_integration::UNKNOWN_DEFAULT), | 40 os_state_(shell_integration::UNKNOWN_DEFAULT), |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeNotDefault) { | 180 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeNotDefault) { |
| 181 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::NOT_DEFAULT, true, | 181 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::NOT_DEFAULT, true, |
| 182 false, false); | 182 false, false); |
| 183 } | 183 } |
| 184 | 184 |
| 185 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) { | 185 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) { |
| 186 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::UNKNOWN_DEFAULT, | 186 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::UNKNOWN_DEFAULT, |
| 187 true, false, false); | 187 true, false, false); |
| 188 } | 188 } |
| OLD | NEW |