Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: chrome/browser/external_protocol/external_protocol_handler_unittest.cc

Issue 1770943005: Removed AttemptResult enum in favor of using DefaultWebClientState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dont_record_async_duration
Patch Set: Merge + simplified Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 {} 24 ~FakeExternalProtocolHandlerWorker() override {}
25 25
26 void CheckIsDefault() override { 26 void CheckIsDefault(bool is_following_set_as_default) override {
27 BrowserThread::PostTask( 27 BrowserThread::PostTask(
28 BrowserThread::UI, FROM_HERE, 28 BrowserThread::UI, FROM_HERE,
29 base::Bind(&FakeExternalProtocolHandlerWorker::OnCheckIsDefaultComplete, 29 base::Bind(&FakeExternalProtocolHandlerWorker::OnCheckIsDefaultComplete,
30 this, os_state_)); 30 this, os_state_, is_following_set_as_default));
31 } 31 }
32 32
33 void SetAsDefault() override { 33 void SetAsDefault() override { CheckIsDefault(true); }
34 BrowserThread::PostTask(
35 BrowserThread::UI, FROM_HERE,
36 base::Bind(
37 &FakeExternalProtocolHandlerWorker::OnSetAsDefaultAttemptComplete,
38 this, AttemptResult::SUCCESS));
39 }
40 34
41 shell_integration::DefaultWebClientState os_state_; 35 shell_integration::DefaultWebClientState os_state_;
42 }; 36 };
43 37
44 class FakeExternalProtocolHandlerDelegate 38 class FakeExternalProtocolHandlerDelegate
45 : public ExternalProtocolHandler::Delegate { 39 : public ExternalProtocolHandler::Delegate {
46 public: 40 public:
47 FakeExternalProtocolHandlerDelegate() 41 FakeExternalProtocolHandlerDelegate()
48 : block_state_(ExternalProtocolHandler::BLOCK), 42 : block_state_(ExternalProtocolHandler::BLOCK),
49 os_state_(shell_integration::UNKNOWN_DEFAULT), 43 os_state_(shell_integration::UNKNOWN_DEFAULT),
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 182
189 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeNotDefault) { 183 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeNotDefault) {
190 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::NOT_DEFAULT, true, 184 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::NOT_DEFAULT, true,
191 false, false); 185 false, false);
192 } 186 }
193 187
194 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) { 188 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) {
195 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::UNKNOWN_DEFAULT, 189 DoTest(ExternalProtocolHandler::UNKNOWN, shell_integration::UNKNOWN_DEFAULT,
196 true, false, false); 190 true, false, false);
197 } 191 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698