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

Side by Side Diff: chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc

Issue 10539169: Prototype version of the first-run dialog for Windows 8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed non-windows compilation errors. Created 8 years, 6 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 | Annotate | Revision Log
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/custom_handlers/protocol_handler_registry.h" 5 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 class FakeClientObserver 85 class FakeClientObserver
86 : public ProtocolHandlerRegistry::DefaultClientObserver { 86 : public ProtocolHandlerRegistry::DefaultClientObserver {
87 public: 87 public:
88 FakeClientObserver(ProtocolHandlerRegistry* registry, 88 FakeClientObserver(ProtocolHandlerRegistry* registry,
89 FakeDelegate* registry_delegate) 89 FakeDelegate* registry_delegate)
90 : ProtocolHandlerRegistry::DefaultClientObserver(registry), 90 : ProtocolHandlerRegistry::DefaultClientObserver(registry),
91 delegate_(registry_delegate) {} 91 delegate_(registry_delegate) {}
92 92
93 virtual void SetDefaultWebClientUIState( 93 virtual void SetDefaultWebClientUIState(
94 ShellIntegration::DefaultWebClientUIState state) { 94 ShellIntegration::DefaultWebClientUIState state,
95 ShellIntegration::SetDefaultWebClientResult call_result) {
95 ProtocolHandlerRegistry::DefaultClientObserver::SetDefaultWebClientUIState( 96 ProtocolHandlerRegistry::DefaultClientObserver::SetDefaultWebClientUIState(
96 state); 97 state, call_result);
97 if (state == ShellIntegration::STATE_IS_DEFAULT) { 98 if (state == ShellIntegration::STATE_IS_DEFAULT) {
98 delegate_->FakeRegisterWithOS(worker_->protocol()); 99 delegate_->FakeRegisterWithOS(worker_->protocol());
99 } 100 }
100 if (state != ShellIntegration::STATE_PROCESSING) { 101 if (state != ShellIntegration::STATE_PROCESSING) {
101 MessageLoop::current()->Quit(); 102 MessageLoop::current()->Quit();
102 } 103 }
103 } 104 }
104 105
105 private: 106 private:
106 FakeDelegate* delegate_; 107 FakeDelegate* delegate_;
(...skipping 12 matching lines...) Expand all
119 virtual ~FakeProtocolClientWorker() {} 120 virtual ~FakeProtocolClientWorker() {}
120 121
121 virtual ShellIntegration::DefaultWebClientState CheckIsDefault() { 122 virtual ShellIntegration::DefaultWebClientState CheckIsDefault() {
122 if (force_failure_) { 123 if (force_failure_) {
123 return ShellIntegration::NOT_DEFAULT_WEB_CLIENT; 124 return ShellIntegration::NOT_DEFAULT_WEB_CLIENT;
124 } else { 125 } else {
125 return ShellIntegration::IS_DEFAULT_WEB_CLIENT; 126 return ShellIntegration::IS_DEFAULT_WEB_CLIENT;
126 } 127 }
127 } 128 }
128 129
129 virtual void SetAsDefault(bool interactive_permitted) {} 130 virtual ShellIntegration::SetDefaultWebClientResult
131 SetAsDefault(bool interactive_permitted) {
132 return ShellIntegration::RESULT_SET_DEFAULT_OK;
133 }
130 134
131 private: 135 private:
132 bool force_failure_; 136 bool force_failure_;
133 }; 137 };
134 138
135 ProtocolHandlerRegistry::DefaultClientObserver* 139 ProtocolHandlerRegistry::DefaultClientObserver*
136 FakeDelegate::CreateShellObserver(ProtocolHandlerRegistry* registry) { 140 FakeDelegate::CreateShellObserver(ProtocolHandlerRegistry* registry) {
137 return new FakeClientObserver(registry, this); 141 return new FakeClientObserver(registry, this);
138 } 142 }
139 143
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 ASSERT_EQ(ph3.url().GetOrigin() == ph2.url().GetOrigin(), 809 ASSERT_EQ(ph3.url().GetOrigin() == ph2.url().GetOrigin(),
806 ph3.IsSameOrigin(ph2)); 810 ph3.IsSameOrigin(ph2));
807 } 811 }
808 812
809 TEST_F(ProtocolHandlerRegistryTest, TestInstallDefaultHandler) { 813 TEST_F(ProtocolHandlerRegistryTest, TestInstallDefaultHandler) {
810 ReloadProtocolHandlerRegistryAndInstallDefaultHandler(); 814 ReloadProtocolHandlerRegistryAndInstallDefaultHandler();
811 std::vector<std::string> protocols; 815 std::vector<std::string> protocols;
812 registry()->GetRegisteredProtocols(&protocols); 816 registry()->GetRegisteredProtocols(&protocols);
813 ASSERT_EQ(static_cast<size_t>(1), protocols.size()); 817 ASSERT_EQ(static_cast<size_t>(1), protocols.size());
814 } 818 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698