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

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

Issue 10139002: Preventing our default handlers for ChromeOS to show up or confuse the user (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Resolving merge issues Created 8 years, 8 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/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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 222 }
223 223
224 void ReloadProtocolHandlerRegistry() { 224 void ReloadProtocolHandlerRegistry() {
225 delegate_ = new FakeDelegate(); 225 delegate_ = new FakeDelegate();
226 registry_->Finalize(); 226 registry_->Finalize();
227 registry_ = NULL; 227 registry_ = NULL;
228 registry_ = new ProtocolHandlerRegistry(profile(), delegate()); 228 registry_ = new ProtocolHandlerRegistry(profile(), delegate());
229 registry_->Load(); 229 registry_->Load();
230 } 230 }
231 231
232 void ReloadProtocolHandlerRegistryAndInstallDefaultHandler() {
233 delegate_ = new FakeDelegate();
234 registry_->Finalize();
235 registry_ = NULL;
236 registry_ = new ProtocolHandlerRegistry(profile(), delegate());
237 registry_->AddDefaultHandler(CreateProtocolHandler(
238 "test", GURL("http://test.com/%s"), "Test"));
239 registry_->Load();
240 }
241
232 virtual void SetUp() { 242 virtual void SetUp() {
233 ui_message_loop_.reset(new MessageLoopForUI()); 243 ui_message_loop_.reset(new MessageLoopForUI());
234 ui_thread_.reset(new content::TestBrowserThread(BrowserThread::UI, 244 ui_thread_.reset(new content::TestBrowserThread(BrowserThread::UI,
235 MessageLoop::current())); 245 MessageLoop::current()));
236 io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO)); 246 io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO));
237 io_thread_->StartIOThread(); 247 io_thread_->StartIOThread();
238 248
239 file_thread_.reset(new content::TestBrowserThread(BrowserThread::FILE)); 249 file_thread_.reset(new content::TestBrowserThread(BrowserThread::FILE));
240 file_thread_->Start(); 250 file_thread_->Start();
241 251
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 GURL("http://other.com/%s"), "test"); 799 GURL("http://other.com/%s"), "test");
790 ASSERT_EQ(ph1.url().GetOrigin() == ph2.url().GetOrigin(), 800 ASSERT_EQ(ph1.url().GetOrigin() == ph2.url().GetOrigin(),
791 ph1.IsSameOrigin(ph2)); 801 ph1.IsSameOrigin(ph2));
792 ASSERT_EQ(ph1.url().GetOrigin() == ph2.url().GetOrigin(), 802 ASSERT_EQ(ph1.url().GetOrigin() == ph2.url().GetOrigin(),
793 ph2.IsSameOrigin(ph1)); 803 ph2.IsSameOrigin(ph1));
794 ASSERT_EQ(ph2.url().GetOrigin() == ph3.url().GetOrigin(), 804 ASSERT_EQ(ph2.url().GetOrigin() == ph3.url().GetOrigin(),
795 ph2.IsSameOrigin(ph3)); 805 ph2.IsSameOrigin(ph3));
796 ASSERT_EQ(ph3.url().GetOrigin() == ph2.url().GetOrigin(), 806 ASSERT_EQ(ph3.url().GetOrigin() == ph2.url().GetOrigin(),
797 ph3.IsSameOrigin(ph2)); 807 ph3.IsSameOrigin(ph2));
798 } 808 }
809
810 TEST_F(ProtocolHandlerRegistryTest, TestInstallDefaultHandler) {
811 ReloadProtocolHandlerRegistryAndInstallDefaultHandler();
812 std::vector<std::string> protocols;
813 registry()->GetRegisteredProtocols(&protocols);
814 ASSERT_EQ(static_cast<size_t>(1), protocols.size());
815 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698