OLD | NEW |
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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/thread_task_runner_handle.h" |
12 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/common/render_messages.h" | 14 #include "chrome/common/render_messages.h" |
14 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
15 #include "chrome/renderer/chrome_content_renderer_client.h" | 16 #include "chrome/renderer/chrome_content_renderer_client.h" |
16 #include "chrome/renderer/plugins/shadow_dom_plugin_placeholder.h" | 17 #include "chrome/renderer/plugins/shadow_dom_plugin_placeholder.h" |
17 #include "chrome/test/base/chrome_render_view_test.h" | 18 #include "chrome/test/base/chrome_render_view_test.h" |
18 #include "content/public/common/content_constants.h" | 19 #include "content/public/common/content_constants.h" |
19 #include "content/public/renderer/render_frame.h" | 20 #include "content/public/renderer/render_frame.h" |
20 #include "content/public/renderer/render_view.h" | 21 #include "content/public/renderer/render_view.h" |
21 #include "content/public/test/mock_render_thread.h" | 22 #include "content/public/test/mock_render_thread.h" |
(...skipping 24 matching lines...) Expand all Loading... |
46 GetMainFrame(), GURL("http://foo"), "GET", false, false, &unused)); | 47 GetMainFrame(), GURL("http://foo"), "GET", false, false, &unused)); |
47 } | 48 } |
48 | 49 |
49 // Tests that renderer-initiated navigations from a non-Instant render process | 50 // Tests that renderer-initiated navigations from a non-Instant render process |
50 // to potentially Instant URLs get bounced back to the browser to be rebucketed | 51 // to potentially Instant URLs get bounced back to the browser to be rebucketed |
51 // into an Instant renderer if necessary. | 52 // into an Instant renderer if necessary. |
52 TEST_F(InstantProcessNavigationTest, ForkForNavigationsToSearchURLs) { | 53 TEST_F(InstantProcessNavigationTest, ForkForNavigationsToSearchURLs) { |
53 ChromeContentRendererClient* client = | 54 ChromeContentRendererClient* client = |
54 static_cast<ChromeContentRendererClient*>(content_renderer_client_.get()); | 55 static_cast<ChromeContentRendererClient*>(content_renderer_client_.get()); |
55 chrome_render_thread_->set_io_message_loop_proxy( | 56 chrome_render_thread_->set_io_message_loop_proxy( |
56 base::MessageLoopProxy::current()); | 57 base::ThreadTaskRunnerHandle::Get()); |
57 client->RenderThreadStarted(); | 58 client->RenderThreadStarted(); |
58 std::vector<GURL> search_urls; | 59 std::vector<GURL> search_urls; |
59 search_urls.push_back(GURL("http://example.com/search")); | 60 search_urls.push_back(GURL("http://example.com/search")); |
60 chrome_render_thread_->Send(new ChromeViewMsg_SetSearchURLs( | 61 chrome_render_thread_->Send(new ChromeViewMsg_SetSearchURLs( |
61 search_urls, GURL("http://example.com/newtab"))); | 62 search_urls, GURL("http://example.com/newtab"))); |
62 bool unused; | 63 bool unused; |
63 EXPECT_TRUE(client->ShouldFork( | 64 EXPECT_TRUE(client->ShouldFork( |
64 GetMainFrame(), GURL("http://example.com/newtab"), "GET", false, false, | 65 GetMainFrame(), GURL("http://example.com/newtab"), "GET", false, false, |
65 &unused)); | 66 &unused)); |
66 EXPECT_TRUE(client->ShouldFork( | 67 EXPECT_TRUE(client->ShouldFork( |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 #if defined(ENABLE_PLUGINS) | 165 #if defined(ENABLE_PLUGINS) |
165 EXPECT_CALL(filter, OnGetPluginInfo(GetRoutingID(), url, _, mime_type, _)) | 166 EXPECT_CALL(filter, OnGetPluginInfo(GetRoutingID(), url, _, mime_type, _)) |
166 .WillOnce(SetArgPointee<4>(output)); | 167 .WillOnce(SetArgPointee<4>(output)); |
167 #endif | 168 #endif |
168 | 169 |
169 scoped_ptr<blink::WebPluginPlaceholder> placeholder = | 170 scoped_ptr<blink::WebPluginPlaceholder> placeholder = |
170 content_renderer_client_->CreatePluginPlaceholder( | 171 content_renderer_client_->CreatePluginPlaceholder( |
171 GetMainRenderFrame(), GetMainFrame(), params); | 172 GetMainRenderFrame(), GetMainFrame(), params); |
172 EXPECT_EQ(nullptr, placeholder); | 173 EXPECT_EQ(nullptr, placeholder); |
173 } | 174 } |
OLD | NEW |