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

Side by Side Diff: content/renderer/render_view_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
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/win/windows_version.h" 11 #include "base/win/windows_version.h"
12 #include "content/child/request_extra_data.h" 12 #include "content/child/request_extra_data.h"
13 #include "content/child/service_worker/service_worker_network_provider.h" 13 #include "content/child/service_worker/service_worker_network_provider.h"
14 #include "content/common/frame_messages.h" 14 #include "content/common/frame_messages.h"
15 #include "content/common/ssl_status_serialization.h" 15 #include "content/common/ssl_status_serialization.h"
16 #include "content/common/view_messages.h" 16 #include "content/common/view_messages.h"
17 #include "content/public/browser/browser_context.h" 17 #include "content/public/browser/browser_context.h"
18 #include "content/public/browser/native_web_keyboard_event.h" 18 #include "content/public/browser/native_web_keyboard_event.h"
19 #include "content/public/browser/web_ui_controller_factory.h" 19 #include "content/public/browser/web_ui_controller_factory.h"
20 #include "content/public/common/bindings_policy.h" 20 #include "content/public/common/bindings_policy.h"
21 #include "content/public/common/page_zoom.h" 21 #include "content/public/common/page_zoom.h"
22 #include "content/public/common/url_constants.h" 22 #include "content/public/common/url_constants.h"
23 #include "content/public/common/url_utils.h" 23 #include "content/public/common/url_utils.h"
24 #include "content/public/renderer/content_renderer_client.h"
24 #include "content/public/renderer/document_state.h" 25 #include "content/public/renderer/document_state.h"
25 #include "content/public/renderer/history_item_serialization.h" 26 #include "content/public/renderer/history_item_serialization.h"
26 #include "content/public/renderer/navigation_state.h" 27 #include "content/public/renderer/navigation_state.h"
27 #include "content/public/test/browser_test_utils.h" 28 #include "content/public/test/browser_test_utils.h"
28 #include "content/public/test/render_view_test.h" 29 #include "content/public/test/render_view_test.h"
29 #include "content/public/test/test_utils.h" 30 #include "content/public/test/test_utils.h"
30 #include "content/renderer/render_view_impl.h" 31 #include "content/renderer/render_view_impl.h"
31 #include "content/shell/browser/shell.h" 32 #include "content/shell/browser/shell.h"
32 #include "content/shell/browser/shell_browser_context.h" 33 #include "content/shell/browser/shell_browser_context.h"
33 #include "content/test/mock_keyboard.h" 34 #include "content/test/mock_keyboard.h"
(...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 2061
2061 EXPECT_TRUE(is_input_type_called); 2062 EXPECT_TRUE(is_input_type_called);
2062 EXPECT_TRUE(is_selection_called); 2063 EXPECT_TRUE(is_selection_called);
2063 2064
2064 // InputTypeChange shold be called earlier than SelectionChanged. 2065 // InputTypeChange shold be called earlier than SelectionChanged.
2065 EXPECT_LT(last_input_type, last_selection); 2066 EXPECT_LT(last_input_type, last_selection);
2066 } 2067 }
2067 2068
2068 class SuppressErrorPageTest : public RenderViewTest { 2069 class SuppressErrorPageTest : public RenderViewTest {
2069 public: 2070 public:
2070 virtual void SetUp() OVERRIDE { 2071 virtual ContentRendererClient* CreateContentRendererClient() OVERRIDE {
2071 SetRendererClientForTesting(&client_); 2072 return new TestContentRendererClient;
2072 RenderViewTest::SetUp();
2073 } 2073 }
2074 2074
2075 RenderViewImpl* view() { 2075 RenderViewImpl* view() {
2076 return static_cast<RenderViewImpl*>(view_); 2076 return static_cast<RenderViewImpl*>(view_);
2077 } 2077 }
2078 2078
2079 RenderFrameImpl* frame() { 2079 RenderFrameImpl* frame() {
2080 return static_cast<RenderFrameImpl*>(view()->GetMainRenderFrame()); 2080 return static_cast<RenderFrameImpl*>(view()->GetMainRenderFrame());
2081 } 2081 }
2082 2082
2083 private: 2083 private:
2084 class TestContentRendererClient : public ContentRendererClient { 2084 class TestContentRendererClient : public ContentRendererClient {
2085 public: 2085 public:
2086 virtual bool ShouldSuppressErrorPage(RenderFrame* render_frame, 2086 virtual bool ShouldSuppressErrorPage(RenderFrame* render_frame,
2087 const GURL& url) OVERRIDE { 2087 const GURL& url) OVERRIDE {
2088 return url == GURL("http://example.com/suppress"); 2088 return url == GURL("http://example.com/suppress");
2089 } 2089 }
2090 2090
2091 virtual void GetNavigationErrorStrings( 2091 virtual void GetNavigationErrorStrings(
2092 content::RenderView* render_view, 2092 content::RenderView* render_view,
2093 blink::WebFrame* frame, 2093 blink::WebFrame* frame,
2094 const blink::WebURLRequest& failed_request, 2094 const blink::WebURLRequest& failed_request,
2095 const blink::WebURLError& error, 2095 const blink::WebURLError& error,
2096 std::string* error_html, 2096 std::string* error_html,
2097 base::string16* error_description) OVERRIDE { 2097 base::string16* error_description) OVERRIDE {
2098 if (error_html) 2098 if (error_html)
2099 *error_html = "A suffusion of yellow."; 2099 *error_html = "A suffusion of yellow.";
2100 } 2100 }
2101 }; 2101 };
2102
2103 TestContentRendererClient client_;
2104 }; 2102 };
2105 2103
2106 #if defined(OS_ANDROID) 2104 #if defined(OS_ANDROID)
2107 // Crashing on Android: http://crbug.com/311341 2105 // Crashing on Android: http://crbug.com/311341
2108 #define MAYBE_Suppresses DISABLED_Suppresses 2106 #define MAYBE_Suppresses DISABLED_Suppresses
2109 #else 2107 #else
2110 #define MAYBE_Suppresses Suppresses 2108 #define MAYBE_Suppresses Suppresses
2111 #endif 2109 #endif
2112 2110
2113 TEST_F(SuppressErrorPageTest, MAYBE_Suppresses) { 2111 TEST_F(SuppressErrorPageTest, MAYBE_Suppresses) {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2323 request.setTargetType(blink::WebURLRequest::TargetIsSubresource); 2321 request.setTargetType(blink::WebURLRequest::TargetIsSubresource);
2324 blink::WebURLResponse redirect_response; 2322 blink::WebURLResponse redirect_response;
2325 frame()->willSendRequest(GetMainFrame(), 0, request, redirect_response); 2323 frame()->willSendRequest(GetMainFrame(), 0, request, redirect_response);
2326 extra_data = static_cast<RequestExtraData*>(request.extraData()); 2324 extra_data = static_cast<RequestExtraData*>(request.extraData());
2327 ASSERT_TRUE(extra_data); 2325 ASSERT_TRUE(extra_data);
2328 EXPECT_EQ(extra_data->service_worker_provider_id(), 2326 EXPECT_EQ(extra_data->service_worker_provider_id(),
2329 provider->provider_id()); 2327 provider->provider_id());
2330 } 2328 }
2331 2329
2332 } // namespace content 2330 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl_browsertest.cc ('k') | content/shell/renderer/shell_content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698