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

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

Issue 10551002: TabContentsWrapper -> TabContents, part 56. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Not killing GetSelectedWebContents yet Created 8 years, 6 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 | Annotate | Revision Log
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 <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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider_observers.h ('k') | chrome/browser/extensions/extension_install_ui_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698