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

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

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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"
11 #include "chrome/browser/tab_contents/render_view_context_menu.h" 11 #include "chrome/browser/tab_contents/render_view_context_menu.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_tabstrip.h"
13 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
14 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
15 #include "content/public/browser/navigation_controller.h" 16 #include "content/public/browser/navigation_controller.h"
16 #include "content/public/browser/navigation_entry.h" 17 #include "content/public/browser/navigation_entry.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
19 20
20 using content::WebContents; 21 using content::WebContents;
21 22
22 namespace { 23 namespace {
(...skipping 21 matching lines...) Expand all
44 45
45 class RegisterProtocolHandlerBrowserTest : public InProcessBrowserTest { 46 class RegisterProtocolHandlerBrowserTest : public InProcessBrowserTest {
46 public: 47 public:
47 RegisterProtocolHandlerBrowserTest() { } 48 RegisterProtocolHandlerBrowserTest() { }
48 49
49 TestRenderViewContextMenu* CreateContextMenu(GURL url) { 50 TestRenderViewContextMenu* CreateContextMenu(GURL url) {
50 content::ContextMenuParams params; 51 content::ContextMenuParams params;
51 params.media_type = WebKit::WebContextMenuData::MediaTypeNone; 52 params.media_type = WebKit::WebContextMenuData::MediaTypeNone;
52 params.link_url = url; 53 params.link_url = url;
53 params.unfiltered_link_url = url; 54 params.unfiltered_link_url = url;
54 WebContents* web_contents = browser()->GetActiveWebContents(); 55 WebContents* web_contents = chrome::GetActiveWebContents(browser());
55 params.page_url = web_contents->GetController().GetActiveEntry()->GetURL(); 56 params.page_url = web_contents->GetController().GetActiveEntry()->GetURL();
56 #if defined(OS_MACOSX) 57 #if defined(OS_MACOSX)
57 params.writing_direction_default = 0; 58 params.writing_direction_default = 0;
58 params.writing_direction_left_to_right = 0; 59 params.writing_direction_left_to_right = 0;
59 params.writing_direction_right_to_left = 0; 60 params.writing_direction_right_to_left = 0;
60 #endif // OS_MACOSX 61 #endif // OS_MACOSX
61 TestRenderViewContextMenu* menu = new TestRenderViewContextMenu( 62 TestRenderViewContextMenu* menu = new TestRenderViewContextMenu(
62 browser()->GetActiveWebContents(), params); 63 chrome::GetActiveWebContents(browser()), params);
63 menu->Init(); 64 menu->Init();
64 return menu; 65 return menu;
65 } 66 }
66 67
67 void AddProtocolHandler(const std::string& protocol, 68 void AddProtocolHandler(const std::string& protocol,
68 const GURL& url, 69 const GURL& url,
69 const string16& title) { 70 const string16& title) {
70 ProtocolHandler handler = ProtocolHandler::CreateProtocolHandler( 71 ProtocolHandler handler = ProtocolHandler::CreateProtocolHandler(
71 protocol, url, title); 72 protocol, url, title);
72 ProtocolHandlerRegistry* registry = 73 ProtocolHandlerRegistry* registry =
(...skipping 27 matching lines...) Expand all
100 } 101 }
101 102
102 IN_PROC_BROWSER_TEST_F(RegisterProtocolHandlerBrowserTest, CustomHandler) { 103 IN_PROC_BROWSER_TEST_F(RegisterProtocolHandlerBrowserTest, CustomHandler) {
103 ASSERT_TRUE(test_server()->Start()); 104 ASSERT_TRUE(test_server()->Start());
104 GURL handler_url = test_server()->GetURL("files/custom_handler_foo.html"); 105 GURL handler_url = test_server()->GetURL("files/custom_handler_foo.html");
105 AddProtocolHandler("foo", handler_url, 106 AddProtocolHandler("foo", handler_url,
106 UTF8ToUTF16(std::string("Test foo Handler"))); 107 UTF8ToUTF16(std::string("Test foo Handler")));
107 108
108 ui_test_utils::NavigateToURL(browser(), GURL("foo:test")); 109 ui_test_utils::NavigateToURL(browser(), GURL("foo:test"));
109 110
110 ASSERT_EQ(handler_url, browser()->GetActiveWebContents()->GetURL()); 111 ASSERT_EQ(handler_url, chrome::GetActiveWebContents(browser())->GetURL());
111 } 112 }
OLDNEW
« no previous file with comments | « chrome/browser/crash_recovery_browsertest.cc ('k') | chrome/browser/custom_home_pages_table_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698