| 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/string16.h" | 8 #include "base/string16.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 class RegisterProtocolHandlerBrowserTest : public InProcessBrowserTest { | 45 class RegisterProtocolHandlerBrowserTest : public InProcessBrowserTest { |
| 46 public: | 46 public: |
| 47 RegisterProtocolHandlerBrowserTest() { } | 47 RegisterProtocolHandlerBrowserTest() { } |
| 48 | 48 |
| 49 TestRenderViewContextMenu* CreateContextMenu(GURL url) { | 49 TestRenderViewContextMenu* CreateContextMenu(GURL url) { |
| 50 content::ContextMenuParams params; | 50 content::ContextMenuParams params; |
| 51 params.media_type = WebKit::WebContextMenuData::MediaTypeNone; | 51 params.media_type = WebKit::WebContextMenuData::MediaTypeNone; |
| 52 params.link_url = url; | 52 params.link_url = url; |
| 53 params.unfiltered_link_url = url; | 53 params.unfiltered_link_url = url; |
| 54 WebContents* web_contents = browser()->GetSelectedWebContents(); | 54 WebContents* web_contents = browser()->GetActiveWebContents(); |
| 55 params.page_url = web_contents->GetController().GetActiveEntry()->GetURL(); | 55 params.page_url = web_contents->GetController().GetActiveEntry()->GetURL(); |
| 56 #if defined(OS_MACOSX) | 56 #if defined(OS_MACOSX) |
| 57 params.writing_direction_default = 0; | 57 params.writing_direction_default = 0; |
| 58 params.writing_direction_left_to_right = 0; | 58 params.writing_direction_left_to_right = 0; |
| 59 params.writing_direction_right_to_left = 0; | 59 params.writing_direction_right_to_left = 0; |
| 60 #endif // OS_MACOSX | 60 #endif // OS_MACOSX |
| 61 TestRenderViewContextMenu* menu = new TestRenderViewContextMenu( | 61 TestRenderViewContextMenu* menu = new TestRenderViewContextMenu( |
| 62 browser()->GetSelectedWebContents(), params); | 62 browser()->GetActiveWebContents(), params); |
| 63 menu->Init(); | 63 menu->Init(); |
| 64 return menu; | 64 return menu; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void AddProtocolHandler(const std::string& protocol, | 67 void AddProtocolHandler(const std::string& protocol, |
| 68 const GURL& url, | 68 const GURL& url, |
| 69 const string16& title) { | 69 const string16& title) { |
| 70 ProtocolHandler handler = ProtocolHandler::CreateProtocolHandler( | 70 ProtocolHandler handler = ProtocolHandler::CreateProtocolHandler( |
| 71 protocol, url, title); | 71 protocol, url, title); |
| 72 ProtocolHandlerRegistry* registry = | 72 ProtocolHandlerRegistry* registry = |
| (...skipping 27 matching lines...) Expand all Loading... |
| 100 } | 100 } |
| 101 | 101 |
| 102 IN_PROC_BROWSER_TEST_F(RegisterProtocolHandlerBrowserTest, CustomHandler) { | 102 IN_PROC_BROWSER_TEST_F(RegisterProtocolHandlerBrowserTest, CustomHandler) { |
| 103 ASSERT_TRUE(test_server()->Start()); | 103 ASSERT_TRUE(test_server()->Start()); |
| 104 GURL handler_url = test_server()->GetURL("files/custom_handler_foo.html"); | 104 GURL handler_url = test_server()->GetURL("files/custom_handler_foo.html"); |
| 105 AddProtocolHandler("foo", handler_url, | 105 AddProtocolHandler("foo", handler_url, |
| 106 UTF8ToUTF16(std::string("Test foo Handler"))); | 106 UTF8ToUTF16(std::string("Test foo Handler"))); |
| 107 | 107 |
| 108 ui_test_utils::NavigateToURL(browser(), GURL("foo:test")); | 108 ui_test_utils::NavigateToURL(browser(), GURL("foo:test")); |
| 109 | 109 |
| 110 ASSERT_EQ(handler_url, browser()->GetSelectedWebContents()->GetURL()); | 110 ASSERT_EQ(handler_url, browser()->GetActiveWebContents()->GetURL()); |
| 111 } | 111 } |
| OLD | NEW |