| 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 374   content::TestBrowserThread io_thread_; | 374   content::TestBrowserThread io_thread_; | 
| 375 | 375 | 
| 376   scoped_ptr<TestingProfile> profile_; | 376   scoped_ptr<TestingProfile> profile_; | 
| 377   FakeDelegate* delegate_;  // Registry assumes ownership of delegate_. | 377   FakeDelegate* delegate_;  // Registry assumes ownership of delegate_. | 
| 378   scoped_ptr<ProtocolHandlerRegistry> registry_; | 378   scoped_ptr<ProtocolHandlerRegistry> registry_; | 
| 379   ProtocolHandler test_protocol_handler_; | 379   ProtocolHandler test_protocol_handler_; | 
| 380 }; | 380 }; | 
| 381 | 381 | 
| 382 // ProtocolHandlerRegistryTest tests are flaky on Linux & ChromeOS. | 382 // ProtocolHandlerRegistryTest tests are flaky on Linux & ChromeOS. | 
| 383 // http://crbug.com/133023 | 383 // http://crbug.com/133023 | 
| 384 #if defined(OS_LINUX) || defined(OS_CHROMEOS) | 384 #if defined(OS_LINUX) | 
| 385 #define MAYBE_AcceptProtocolHandlerHandlesProtocol \ | 385 #define MAYBE_AcceptProtocolHandlerHandlesProtocol \ | 
| 386     DISABLED_AcceptProtocolHandlerHandlesProtocol | 386     DISABLED_AcceptProtocolHandlerHandlesProtocol | 
| 387 #define MAYBE_DeniedProtocolIsntHandledUntilAccepted \ | 387 #define MAYBE_DeniedProtocolIsntHandledUntilAccepted \ | 
| 388     DISABLED_DeniedProtocolIsntHandledUntilAccepted | 388     DISABLED_DeniedProtocolIsntHandledUntilAccepted | 
| 389 #define MAYBE_TestStartsAsDefault DISABLED_TestStartsAsDefault | 389 #define MAYBE_TestStartsAsDefault DISABLED_TestStartsAsDefault | 
| 390 #define MAYBE_TestRemoveHandlerRemovesDefault \ | 390 #define MAYBE_TestRemoveHandlerRemovesDefault \ | 
| 391     DISABLED_TestRemoveHandlerRemovesDefault | 391     DISABLED_TestRemoveHandlerRemovesDefault | 
| 392 #define MAYBE_TestClearDefaultGetsPropagatedToIO \ | 392 #define MAYBE_TestClearDefaultGetsPropagatedToIO \ | 
| 393     DISABLED_TestClearDefaultGetsPropagatedToIO | 393     DISABLED_TestClearDefaultGetsPropagatedToIO | 
| 394 #define MAYBE_TestIsHandledProtocolWorksOnIOThread \ | 394 #define MAYBE_TestIsHandledProtocolWorksOnIOThread \ | 
| 395     DISABLED_TestIsHandledProtocolWorksOnIOThread | 395     DISABLED_TestIsHandledProtocolWorksOnIOThread | 
| 396 #define MAYBE_TestInstallDefaultHandler \ | 396 #define MAYBE_TestInstallDefaultHandler \ | 
| 397     DISABLED_TestInstallDefaultHandler | 397     DISABLED_TestInstallDefaultHandler | 
| 398 #else | 398 #else | 
| 399 #define MAYBE_AcceptProtocolHandlerHandlesProtocol \ | 399 #define MAYBE_AcceptProtocolHandlerHandlesProtocol \ | 
| 400     AcceptProtocolHandlerHandlesProtocol | 400     AcceptProtocolHandlerHandlesProtocol | 
| 401 #define MAYBE_DeniedProtocolIsntHandledUntilAccepted \ | 401 #define MAYBE_DeniedProtocolIsntHandledUntilAccepted \ | 
| 402     DeniedProtocolIsntHandledUntilAccepted | 402     DeniedProtocolIsntHandledUntilAccepted | 
| 403 #define MAYBE_TestStartsAsDefault TestStartsAsDefault | 403 #define MAYBE_TestStartsAsDefault TestStartsAsDefault | 
| 404 #define MAYBE_TestRemoveHandlerRemovesDefault TestRemoveHandlerRemovesDefault | 404 #define MAYBE_TestRemoveHandlerRemovesDefault TestRemoveHandlerRemovesDefault | 
| 405 #define MAYBE_TestClearDefaultGetsPropagatedToIO \ | 405 #define MAYBE_TestClearDefaultGetsPropagatedToIO \ | 
| 406     TestClearDefaultGetsPropagatedToIO | 406     TestClearDefaultGetsPropagatedToIO | 
| 407 #define MAYBE_TestIsHandledProtocolWorksOnIOThread \ | 407 #define MAYBE_TestIsHandledProtocolWorksOnIOThread \ | 
| 408     TestIsHandledProtocolWorksOnIOThread | 408     TestIsHandledProtocolWorksOnIOThread | 
| 409 #define MAYBE_TestInstallDefaultHandler TestInstallDefaultHandler | 409 #define MAYBE_TestInstallDefaultHandler TestInstallDefaultHandler | 
| 410 #endif  // defined(OS_CHROMEOS) | 410 #endif  // defined(OS_LINUX) | 
| 411 | 411 | 
| 412 TEST_F(ProtocolHandlerRegistryTest, | 412 TEST_F(ProtocolHandlerRegistryTest, | 
| 413        MAYBE_AcceptProtocolHandlerHandlesProtocol) { | 413        MAYBE_AcceptProtocolHandlerHandlesProtocol) { | 
| 414   ASSERT_FALSE(registry()->IsHandledProtocol("test")); | 414   ASSERT_FALSE(registry()->IsHandledProtocol("test")); | 
| 415   registry()->OnAcceptRegisterProtocolHandler(test_protocol_handler()); | 415   registry()->OnAcceptRegisterProtocolHandler(test_protocol_handler()); | 
| 416   ASSERT_TRUE(registry()->IsHandledProtocol("test")); | 416   ASSERT_TRUE(registry()->IsHandledProtocol("test")); | 
| 417 } | 417 } | 
| 418 | 418 | 
| 419 TEST_F(ProtocolHandlerRegistryTest, | 419 TEST_F(ProtocolHandlerRegistryTest, | 
| 420        MAYBE_DeniedProtocolIsntHandledUntilAccepted) { | 420        MAYBE_DeniedProtocolIsntHandledUntilAccepted) { | 
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 923 | 923 | 
| 924 TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) { | 924 TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) { | 
| 925   RecreateRegistry(false); | 925   RecreateRegistry(false); | 
| 926   registry()->AddPredefinedHandler(CreateProtocolHandler( | 926   registry()->AddPredefinedHandler(CreateProtocolHandler( | 
| 927       "test", GURL("http://test.com/%s"), "Test")); | 927       "test", GURL("http://test.com/%s"), "Test")); | 
| 928   registry()->InitProtocolSettings(); | 928   registry()->InitProtocolSettings(); | 
| 929   std::vector<std::string> protocols; | 929   std::vector<std::string> protocols; | 
| 930   registry()->GetRegisteredProtocols(&protocols); | 930   registry()->GetRegisteredProtocols(&protocols); | 
| 931   ASSERT_EQ(static_cast<size_t>(1), protocols.size()); | 931   ASSERT_EQ(static_cast<size_t>(1), protocols.size()); | 
| 932 } | 932 } | 
| OLD | NEW | 
|---|