| 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/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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 registry_.reset(new ProtocolHandlerRegistry(profile(), delegate())); | 383 registry_.reset(new ProtocolHandlerRegistry(profile(), delegate())); |
| 384 if (initialize) registry_->InitProtocolSettings(); | 384 if (initialize) registry_->InitProtocolSettings(); |
| 385 } | 385 } |
| 386 | 386 |
| 387 void TeadDownRegistry() { | 387 void TeadDownRegistry() { |
| 388 registry_->Shutdown(); | 388 registry_->Shutdown(); |
| 389 registry_.reset(); | 389 registry_.reset(); |
| 390 // Registry owns the delegate_ it handles deletion of that object. | 390 // Registry owns the delegate_ it handles deletion of that object. |
| 391 } | 391 } |
| 392 | 392 |
| 393 virtual void SetUp() { | 393 void SetUp() override { |
| 394 profile_.reset(new TestingProfile()); | 394 profile_.reset(new TestingProfile()); |
| 395 CHECK(profile_->GetPrefs()); | 395 CHECK(profile_->GetPrefs()); |
| 396 SetUpRegistry(true); | 396 SetUpRegistry(true); |
| 397 test_protocol_handler_ = | 397 test_protocol_handler_ = |
| 398 CreateProtocolHandler("test", GURL("http://test.com/%s")); | 398 CreateProtocolHandler("test", GURL("http://test.com/%s")); |
| 399 } | 399 } |
| 400 | 400 |
| 401 virtual void TearDown() { | 401 void TearDown() override { TeadDownRegistry(); } |
| 402 TeadDownRegistry(); | |
| 403 } | |
| 404 | 402 |
| 405 TestMessageLoop loop_; | 403 TestMessageLoop loop_; |
| 406 | 404 |
| 407 private: | 405 private: |
| 408 content::TestBrowserThread ui_thread_; | 406 content::TestBrowserThread ui_thread_; |
| 409 content::TestBrowserThread file_thread_; | 407 content::TestBrowserThread file_thread_; |
| 410 content::TestBrowserThread io_thread_; | 408 content::TestBrowserThread io_thread_; |
| 411 | 409 |
| 412 scoped_ptr<TestingProfile> profile_; | 410 scoped_ptr<TestingProfile> profile_; |
| 413 FakeDelegate* delegate_; // Registry assumes ownership of delegate_. | 411 FakeDelegate* delegate_; // Registry assumes ownership of delegate_. |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 // added to pref. | 1108 // added to pref. |
| 1111 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2); | 1109 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2); |
| 1112 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); | 1110 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); |
| 1113 | 1111 |
| 1114 registry()->RemoveIgnoredHandler(p2u1); | 1112 registry()->RemoveIgnoredHandler(p2u1); |
| 1115 | 1113 |
| 1116 // p2u1 installed by user and policy, so it is removed from pref alone. | 1114 // p2u1 installed by user and policy, so it is removed from pref alone. |
| 1117 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1); | 1115 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1); |
| 1118 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); | 1116 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); |
| 1119 } | 1117 } |
| OLD | NEW |