| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 params.writing_direction_right_to_left = 0; | 62 params.writing_direction_right_to_left = 0; |
| 63 #endif // OS_MACOSX | 63 #endif // OS_MACOSX |
| 64 TestRenderViewContextMenu* menu = new TestRenderViewContextMenu( | 64 TestRenderViewContextMenu* menu = new TestRenderViewContextMenu( |
| 65 browser()->tab_strip_model()->GetActiveWebContents(), params); | 65 browser()->tab_strip_model()->GetActiveWebContents(), params); |
| 66 menu->Init(); | 66 menu->Init(); |
| 67 return menu; | 67 return menu; |
| 68 } | 68 } |
| 69 | 69 |
| 70 void AddProtocolHandler(const std::string& protocol, | 70 void AddProtocolHandler(const std::string& protocol, |
| 71 const GURL& url, | 71 const GURL& url, |
| 72 const string16& title) { | 72 const base::string16& title) { |
| 73 ProtocolHandler handler = ProtocolHandler::CreateProtocolHandler( | 73 ProtocolHandler handler = ProtocolHandler::CreateProtocolHandler( |
| 74 protocol, url, title); | 74 protocol, url, title); |
| 75 ProtocolHandlerRegistry* registry = | 75 ProtocolHandlerRegistry* registry = |
| 76 ProtocolHandlerRegistryFactory::GetForProfile(browser()->profile()); | 76 ProtocolHandlerRegistryFactory::GetForProfile(browser()->profile()); |
| 77 // Fake that this registration is happening on profile startup. Otherwise | 77 // Fake that this registration is happening on profile startup. Otherwise |
| 78 // it'll try to register with the OS, which causes DCHECKs on Windows when | 78 // it'll try to register with the OS, which causes DCHECKs on Windows when |
| 79 // running as admin on Windows 7. | 79 // running as admin on Windows 7. |
| 80 registry->is_loading_ = true; | 80 registry->is_loading_ = true; |
| 81 registry->OnAcceptRegisterProtocolHandler(handler); | 81 registry->OnAcceptRegisterProtocolHandler(handler); |
| 82 registry->is_loading_ = false; | 82 registry->is_loading_ = false; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 105 ASSERT_TRUE(test_server()->Start()); | 105 ASSERT_TRUE(test_server()->Start()); |
| 106 GURL handler_url = test_server()->GetURL("files/custom_handler_foo.html"); | 106 GURL handler_url = test_server()->GetURL("files/custom_handler_foo.html"); |
| 107 AddProtocolHandler("foo", handler_url, | 107 AddProtocolHandler("foo", handler_url, |
| 108 UTF8ToUTF16(std::string("Test foo Handler"))); | 108 UTF8ToUTF16(std::string("Test foo Handler"))); |
| 109 | 109 |
| 110 ui_test_utils::NavigateToURL(browser(), GURL("foo:test")); | 110 ui_test_utils::NavigateToURL(browser(), GURL("foo:test")); |
| 111 | 111 |
| 112 ASSERT_EQ(handler_url, | 112 ASSERT_EQ(handler_url, |
| 113 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 113 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
| 114 } | 114 } |
| OLD | NEW |