| 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 #ifndef CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ |
| 6 #define CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ | 6 #define CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/message_loop/message_loop.h" | |
| 15 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "base/test/scoped_task_environment.h" |
| 16 #include "base/test/test_io_thread.h" | 16 #include "base/test/test_io_thread.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.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/common/main_function_params.h" | 19 #include "content/public/common/main_function_params.h" |
| 20 #include "content/public/common/page_state.h" | 20 #include "content/public/common/page_state.h" |
| 21 #include "content/public/test/mock_render_thread.h" | 21 #include "content/public/test/mock_render_thread.h" |
| 22 #include "mojo/edk/embedder/scoped_ipc_support.h" | 22 #include "mojo/edk/embedder/scoped_ipc_support.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 24 #include "third_party/WebKit/public/platform/Platform.h" | 24 #include "third_party/WebKit/public/platform/Platform.h" |
| 25 #include "third_party/WebKit/public/web/WebFrame.h" | 25 #include "third_party/WebKit/public/web/WebFrame.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 private: | 68 private: |
| 69 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler_; | 69 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler_; |
| 70 std::unique_ptr<RendererBlinkPlatformImplTestOverrideImpl> | 70 std::unique_ptr<RendererBlinkPlatformImplTestOverrideImpl> |
| 71 blink_platform_impl_; | 71 blink_platform_impl_; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 RenderViewTest(); | 74 RenderViewTest(); |
| 75 ~RenderViewTest() override; | 75 ~RenderViewTest() override; |
| 76 | 76 |
| 77 protected: | 77 protected: |
| 78 // Spins the message loop to process all messages that are currently pending. | |
| 79 void ProcessPendingMessages(); | |
| 80 | |
| 81 // Returns a pointer to the main frame. | 78 // Returns a pointer to the main frame. |
| 82 blink::WebLocalFrame* GetMainFrame(); | 79 blink::WebLocalFrame* GetMainFrame(); |
| 83 | 80 |
| 84 // Executes the given JavaScript in the context of the main frame. The input | 81 // Executes the given JavaScript in the context of the main frame. The input |
| 85 // is a NULL-terminated UTF-8 string. | 82 // is a NULL-terminated UTF-8 string. |
| 86 void ExecuteJavaScriptForTests(const char* js); | 83 void ExecuteJavaScriptForTests(const char* js); |
| 87 | 84 |
| 88 // Executes the given JavaScript and sets the int value it evaluates to in | 85 // Executes the given JavaScript and sets the int value it evaluates to in |
| 89 // |result|. | 86 // |result|. |
| 90 // Returns true if the JavaScript was evaluated correctly to an int value, | 87 // Returns true if the JavaScript was evaluated correctly to an int value, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 virtual std::unique_ptr<ResizeParams> InitialSizeParams(); | 180 virtual std::unique_ptr<ResizeParams> InitialSizeParams(); |
| 184 | 181 |
| 185 // testing::Test | 182 // testing::Test |
| 186 void SetUp() override; | 183 void SetUp() override; |
| 187 | 184 |
| 188 void TearDown() override; | 185 void TearDown() override; |
| 189 | 186 |
| 190 // blink::WebLeakDetectorClient implementation. | 187 // blink::WebLeakDetectorClient implementation. |
| 191 void OnLeakDetectionComplete(const Result& result) override; | 188 void OnLeakDetectionComplete(const Result& result) override; |
| 192 | 189 |
| 193 base::MessageLoop msg_loop_; | 190 protected: |
| 191 base::test::ScopedTaskEnvironment scoped_task_environment_; |
| 192 |
| 194 std::unique_ptr<FakeCompositorDependencies> compositor_deps_; | 193 std::unique_ptr<FakeCompositorDependencies> compositor_deps_; |
| 195 std::unique_ptr<MockRenderProcess> mock_process_; | 194 std::unique_ptr<MockRenderProcess> mock_process_; |
| 196 // We use a naked pointer because we don't want to expose RenderViewImpl in | 195 // We use a naked pointer because we don't want to expose RenderViewImpl in |
| 197 // the embedder's namespace. | 196 // the embedder's namespace. |
| 198 RenderView* view_; | 197 RenderView* view_; |
| 199 RendererBlinkPlatformImplTestOverride blink_platform_impl_; | 198 RendererBlinkPlatformImplTestOverride blink_platform_impl_; |
| 200 std::unique_ptr<ContentClient> content_client_; | 199 std::unique_ptr<ContentClient> content_client_; |
| 201 std::unique_ptr<ContentBrowserClient> content_browser_client_; | 200 std::unique_ptr<ContentBrowserClient> content_browser_client_; |
| 202 std::unique_ptr<ContentRendererClient> content_renderer_client_; | 201 std::unique_ptr<ContentRendererClient> content_renderer_client_; |
| 203 std::unique_ptr<MockRenderThread> render_thread_; | 202 std::unique_ptr<MockRenderThread> render_thread_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 216 std::unique_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; | 215 std::unique_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; |
| 217 #endif | 216 #endif |
| 218 | 217 |
| 219 private: | 218 private: |
| 220 void GoToOffset(int offset, const GURL& url, const PageState& state); | 219 void GoToOffset(int offset, const GURL& url, const PageState& state); |
| 221 }; | 220 }; |
| 222 | 221 |
| 223 } // namespace content | 222 } // namespace content |
| 224 | 223 |
| 225 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ | 224 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ |
| OLD | NEW |