OLD | NEW |
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 "content/public/test/render_view_test.h" | 5 #include "content/public/test/render_view_test.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cctype> | 9 #include <cctype> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "content/test/test_render_frame.h" | 39 #include "content/test/test_render_frame.h" |
40 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 40 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
41 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 41 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
42 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" | 42 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
43 #include "third_party/WebKit/public/web/WebDocument.h" | 43 #include "third_party/WebKit/public/web/WebDocument.h" |
44 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 44 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
45 #include "third_party/WebKit/public/web/WebInputElement.h" | 45 #include "third_party/WebKit/public/web/WebInputElement.h" |
46 #include "third_party/WebKit/public/web/WebInputEvent.h" | 46 #include "third_party/WebKit/public/web/WebInputEvent.h" |
47 #include "third_party/WebKit/public/web/WebKit.h" | 47 #include "third_party/WebKit/public/web/WebKit.h" |
48 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 48 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 49 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
49 #include "third_party/WebKit/public/web/WebScriptSource.h" | 50 #include "third_party/WebKit/public/web/WebScriptSource.h" |
50 #include "third_party/WebKit/public/web/WebView.h" | 51 #include "third_party/WebKit/public/web/WebView.h" |
51 #include "ui/base/resource/resource_bundle.h" | 52 #include "ui/base/resource/resource_bundle.h" |
52 #include "ui/events/keycodes/keyboard_codes.h" | 53 #include "ui/events/keycodes/keyboard_codes.h" |
53 #include "v8/include/v8.h" | 54 #include "v8/include/v8.h" |
54 | 55 |
55 #if defined(OS_MACOSX) | 56 #if defined(OS_MACOSX) |
56 #include "base/mac/scoped_nsautorelease_pool.h" | 57 #include "base/mac/scoped_nsautorelease_pool.h" |
57 #endif | 58 #endif |
58 | 59 |
59 #if defined(OS_WIN) | 60 #if defined(OS_WIN) |
60 #include "content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h" | 61 #include "content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h" |
61 #include "content/test/dwrite_font_fake_sender_win.h" | 62 #include "content/test/dwrite_font_fake_sender_win.h" |
62 #endif | 63 #endif |
63 | 64 |
64 using blink::WebGestureEvent; | 65 using blink::WebGestureEvent; |
65 using blink::WebInputEvent; | 66 using blink::WebInputEvent; |
66 using blink::WebLocalFrame; | 67 using blink::WebLocalFrame; |
67 using blink::WebMouseEvent; | 68 using blink::WebMouseEvent; |
| 69 using blink::WebRuntimeFeatures; |
68 using blink::WebScriptSource; | 70 using blink::WebScriptSource; |
69 using blink::WebString; | 71 using blink::WebString; |
70 using blink::WebURLRequest; | 72 using blink::WebURLRequest; |
71 | 73 |
72 namespace { | 74 namespace { |
73 | 75 |
74 const int32_t kRouteId = 5; | 76 const int32_t kRouteId = 5; |
75 const int32_t kMainFrameRouteId = 6; | 77 const int32_t kMainFrameRouteId = 6; |
76 // TODO(avi): Widget routing IDs should be distinct from the view routing IDs, | 78 // TODO(avi): Widget routing IDs should be distinct from the view routing IDs, |
77 // once RenderWidgetHost is distilled from RenderViewHostImpl. | 79 // once RenderWidgetHost is distilled from RenderViewHostImpl. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 229 |
228 void RenderViewTest::GoForward(const GURL& url, const PageState& state) { | 230 void RenderViewTest::GoForward(const GURL& url, const PageState& state) { |
229 GoToOffset(1, url, state); | 231 GoToOffset(1, url, state); |
230 } | 232 } |
231 | 233 |
232 void RenderViewTest::SetUp() { | 234 void RenderViewTest::SetUp() { |
233 // Blink needs to be initialized before calling CreateContentRendererClient() | 235 // Blink needs to be initialized before calling CreateContentRendererClient() |
234 // because it uses blink internally. | 236 // because it uses blink internally. |
235 blink::initialize(blink_platform_impl_.Get()); | 237 blink::initialize(blink_platform_impl_.Get()); |
236 | 238 |
| 239 // Enable Blink's experimental and test only features so that test code |
| 240 // does not have to bother enabling each feature. |
| 241 WebRuntimeFeatures::enableExperimentalFeatures(true); |
| 242 WebRuntimeFeatures::enableTestOnlyFeatures(true); |
| 243 |
237 content_client_.reset(CreateContentClient()); | 244 content_client_.reset(CreateContentClient()); |
238 content_browser_client_.reset(CreateContentBrowserClient()); | 245 content_browser_client_.reset(CreateContentBrowserClient()); |
239 content_renderer_client_.reset(CreateContentRendererClient()); | 246 content_renderer_client_.reset(CreateContentRendererClient()); |
240 SetContentClient(content_client_.get()); | 247 SetContentClient(content_client_.get()); |
241 SetBrowserClientForTesting(content_browser_client_.get()); | 248 SetBrowserClientForTesting(content_browser_client_.get()); |
242 SetRendererClientForTesting(content_renderer_client_.get()); | 249 SetRendererClientForTesting(content_renderer_client_.get()); |
243 | 250 |
244 #if defined(OS_WIN) | 251 #if defined(OS_WIN) |
245 // This needs to happen sometime before PlatformInitialize. | 252 // This needs to happen sometime before PlatformInitialize. |
246 // This isn't actually necessary for most tests: most tests are able to | 253 // This isn't actually necessary for most tests: most tests are able to |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 665 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
659 frame->Navigate(common_params, StartNavigationParams(), request_params); | 666 frame->Navigate(common_params, StartNavigationParams(), request_params); |
660 | 667 |
661 // The load actually happens asynchronously, so we pump messages to process | 668 // The load actually happens asynchronously, so we pump messages to process |
662 // the pending continuation. | 669 // the pending continuation. |
663 FrameLoadWaiter(frame).Wait(); | 670 FrameLoadWaiter(frame).Wait(); |
664 view_->GetWebView()->updateAllLifecyclePhases(); | 671 view_->GetWebView()->updateAllLifecyclePhases(); |
665 } | 672 } |
666 | 673 |
667 } // namespace content | 674 } // namespace content |
OLD | NEW |