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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client_browsertest.cc

Issue 190663012: Run ContentMain in a browser_test's browser process. This removes duplication of code in the browse… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: try to fix android by restoring old path just for it Created 6 years, 9 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
« no previous file with comments | « chrome/interactive_ui_tests.isolate ('k') | chrome/renderer/extensions/dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
11 #include "chrome/common/render_messages.h" 11 #include "chrome/common/render_messages.h"
12 #include "chrome/renderer/chrome_content_renderer_client.h"
12 #include "chrome/test/base/chrome_render_view_test.h" 13 #include "chrome/test/base/chrome_render_view_test.h"
13 #include "url/gurl.h" 14 #include "url/gurl.h"
14 15
15 typedef ChromeRenderViewTest InstantProcessNavigationTest; 16 typedef ChromeRenderViewTest InstantProcessNavigationTest;
16 17
17 // Tests that renderer-initiated navigations from an Instant render process get 18 // Tests that renderer-initiated navigations from an Instant render process get
18 // bounced back to the browser to be rebucketed into a non-Instant renderer if 19 // bounced back to the browser to be rebucketed into a non-Instant renderer if
19 // necessary. 20 // necessary.
20 TEST_F(InstantProcessNavigationTest, ForkForNavigationsFromInstantProcess) { 21 TEST_F(InstantProcessNavigationTest, ForkForNavigationsFromInstantProcess) {
21 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kInstantProcess); 22 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kInstantProcess);
22 bool unused; 23 bool unused;
23 EXPECT_TRUE(chrome_content_renderer_client_.ShouldFork( 24 ChromeContentRendererClient* client =
25 static_cast<ChromeContentRendererClient*>(content_renderer_client_.get());
26 EXPECT_TRUE(client->ShouldFork(
24 GetMainFrame(), GURL("http://foo"), "GET", false, false, &unused)); 27 GetMainFrame(), GURL("http://foo"), "GET", false, false, &unused));
25 } 28 }
26 29
27 // Tests that renderer-initiated navigations from a non-Instant render process 30 // Tests that renderer-initiated navigations from a non-Instant render process
28 // to potentially Instant URLs get bounced back to the browser to be rebucketed 31 // to potentially Instant URLs get bounced back to the browser to be rebucketed
29 // into an Instant renderer if necessary. 32 // into an Instant renderer if necessary.
30 TEST_F(InstantProcessNavigationTest, ForkForNavigationsToSearchURLs) { 33 TEST_F(InstantProcessNavigationTest, ForkForNavigationsToSearchURLs) {
34 ChromeContentRendererClient* client =
35 static_cast<ChromeContentRendererClient*>(content_renderer_client_.get());
31 chrome_render_thread_->set_io_message_loop_proxy( 36 chrome_render_thread_->set_io_message_loop_proxy(
32 base::MessageLoopProxy::current()); 37 base::MessageLoopProxy::current());
33 chrome_content_renderer_client_.RenderThreadStarted(); 38 client->RenderThreadStarted();
34 std::vector<GURL> search_urls; 39 std::vector<GURL> search_urls;
35 search_urls.push_back(GURL("http://example.com/search")); 40 search_urls.push_back(GURL("http://example.com/search"));
36 chrome_render_thread_->Send(new ChromeViewMsg_SetSearchURLs( 41 chrome_render_thread_->Send(new ChromeViewMsg_SetSearchURLs(
37 search_urls, GURL("http://example.com/newtab"))); 42 search_urls, GURL("http://example.com/newtab")));
38 bool unused; 43 bool unused;
39 EXPECT_TRUE(chrome_content_renderer_client_.ShouldFork( 44 EXPECT_TRUE(client->ShouldFork(
40 GetMainFrame(), GURL("http://example.com/newtab"), "GET", false, false, 45 GetMainFrame(), GURL("http://example.com/newtab"), "GET", false, false,
41 &unused)); 46 &unused));
42 EXPECT_TRUE(chrome_content_renderer_client_.ShouldFork( 47 EXPECT_TRUE(client->ShouldFork(
43 GetMainFrame(), GURL("http://example.com/search?q=foo"), "GET", false, 48 GetMainFrame(), GURL("http://example.com/search?q=foo"), "GET", false,
44 false, &unused)); 49 false, &unused));
45 EXPECT_FALSE(chrome_content_renderer_client_.ShouldFork( 50 EXPECT_FALSE(client->ShouldFork(
46 GetMainFrame(), GURL("http://example.com/"), "GET", false, false, 51 GetMainFrame(), GURL("http://example.com/"), "GET", false, false,
47 &unused)); 52 &unused));
48 } 53 }
OLDNEW
« no previous file with comments | « chrome/interactive_ui_tests.isolate ('k') | chrome/renderer/extensions/dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698