| 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 <string> | 11 #include <string> |
| 11 | 12 |
| 12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.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/test/scoped_ipc_support.h" | 22 #include "mojo/edk/test/scoped_ipc_support.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // A special BlinkPlatformImpl class with overrides that are useful for | 55 // A special BlinkPlatformImpl class with overrides that are useful for |
| 56 // RenderViewTest. | 56 // RenderViewTest. |
| 57 class RendererBlinkPlatformImplTestOverride { | 57 class RendererBlinkPlatformImplTestOverride { |
| 58 public: | 58 public: |
| 59 RendererBlinkPlatformImplTestOverride(); | 59 RendererBlinkPlatformImplTestOverride(); |
| 60 ~RendererBlinkPlatformImplTestOverride(); | 60 ~RendererBlinkPlatformImplTestOverride(); |
| 61 blink::Platform* Get() const; | 61 blink::Platform* Get() const; |
| 62 void Shutdown(); | 62 void Shutdown(); |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 scoped_ptr<scheduler::RendererScheduler> renderer_scheduler_; | 65 std::unique_ptr<scheduler::RendererScheduler> renderer_scheduler_; |
| 66 scoped_ptr<RendererBlinkPlatformImplTestOverrideImpl> blink_platform_impl_; | 66 std::unique_ptr<RendererBlinkPlatformImplTestOverrideImpl> |
| 67 blink_platform_impl_; |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 RenderViewTest(); | 70 RenderViewTest(); |
| 70 ~RenderViewTest() override; | 71 ~RenderViewTest() override; |
| 71 | 72 |
| 72 protected: | 73 protected: |
| 73 // Spins the message loop to process all messages that are currently pending. | 74 // Spins the message loop to process all messages that are currently pending. |
| 74 void ProcessPendingMessages(); | 75 void ProcessPendingMessages(); |
| 75 | 76 |
| 76 // Returns a pointer to the main frame. | 77 // Returns a pointer to the main frame. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 void DidNavigateWithinPage(blink::WebLocalFrame* frame, | 170 void DidNavigateWithinPage(blink::WebLocalFrame* frame, |
| 170 bool is_new_navigation); | 171 bool is_new_navigation); |
| 171 blink::WebWidget* GetWebWidget(); | 172 blink::WebWidget* GetWebWidget(); |
| 172 | 173 |
| 173 // Allows a subclass to override the various content client implementations. | 174 // Allows a subclass to override the various content client implementations. |
| 174 virtual ContentClient* CreateContentClient(); | 175 virtual ContentClient* CreateContentClient(); |
| 175 virtual ContentBrowserClient* CreateContentBrowserClient(); | 176 virtual ContentBrowserClient* CreateContentBrowserClient(); |
| 176 virtual ContentRendererClient* CreateContentRendererClient(); | 177 virtual ContentRendererClient* CreateContentRendererClient(); |
| 177 | 178 |
| 178 // Allows a subclass to customize the initial size of the RenderView. | 179 // Allows a subclass to customize the initial size of the RenderView. |
| 179 virtual scoped_ptr<ResizeParams> InitialSizeParams(); | 180 virtual std::unique_ptr<ResizeParams> InitialSizeParams(); |
| 180 | 181 |
| 181 // testing::Test | 182 // testing::Test |
| 182 void SetUp() override; | 183 void SetUp() override; |
| 183 | 184 |
| 184 void TearDown() override; | 185 void TearDown() override; |
| 185 | 186 |
| 186 // blink::WebLeakDetectorClient implementation. | 187 // blink::WebLeakDetectorClient implementation. |
| 187 void onLeakDetectionComplete(const Result& result) override; | 188 void onLeakDetectionComplete(const Result& result) override; |
| 188 | 189 |
| 189 base::MessageLoop msg_loop_; | 190 base::MessageLoop msg_loop_; |
| 190 scoped_ptr<FakeCompositorDependencies> compositor_deps_; | 191 std::unique_ptr<FakeCompositorDependencies> compositor_deps_; |
| 191 scoped_ptr<MockRenderProcess> mock_process_; | 192 std::unique_ptr<MockRenderProcess> mock_process_; |
| 192 // We use a naked pointer because we don't want to expose RenderViewImpl in | 193 // We use a naked pointer because we don't want to expose RenderViewImpl in |
| 193 // the embedder's namespace. | 194 // the embedder's namespace. |
| 194 RenderView* view_; | 195 RenderView* view_; |
| 195 RendererBlinkPlatformImplTestOverride blink_platform_impl_; | 196 RendererBlinkPlatformImplTestOverride blink_platform_impl_; |
| 196 scoped_ptr<ContentClient> content_client_; | 197 std::unique_ptr<ContentClient> content_client_; |
| 197 scoped_ptr<ContentBrowserClient> content_browser_client_; | 198 std::unique_ptr<ContentBrowserClient> content_browser_client_; |
| 198 scoped_ptr<ContentRendererClient> content_renderer_client_; | 199 std::unique_ptr<ContentRendererClient> content_renderer_client_; |
| 199 scoped_ptr<MockRenderThread> render_thread_; | 200 std::unique_ptr<MockRenderThread> render_thread_; |
| 200 | 201 |
| 201 // Used to setup the process so renderers can run. | 202 // Used to setup the process so renderers can run. |
| 202 scoped_ptr<RendererMainPlatformDelegate> platform_; | 203 std::unique_ptr<RendererMainPlatformDelegate> platform_; |
| 203 scoped_ptr<MainFunctionParams> params_; | 204 std::unique_ptr<MainFunctionParams> params_; |
| 204 scoped_ptr<base::CommandLine> command_line_; | 205 std::unique_ptr<base::CommandLine> command_line_; |
| 205 | 206 |
| 206 // For Mojo. | 207 // For Mojo. |
| 207 scoped_ptr<base::TestIOThread> test_io_thread_; | 208 std::unique_ptr<base::TestIOThread> test_io_thread_; |
| 208 scoped_ptr<mojo::edk::test::ScopedIPCSupport> ipc_support_; | 209 std::unique_ptr<mojo::edk::test::ScopedIPCSupport> ipc_support_; |
| 209 | 210 |
| 210 #if defined(OS_MACOSX) | 211 #if defined(OS_MACOSX) |
| 211 scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; | 212 std::unique_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; |
| 212 #endif | 213 #endif |
| 213 | 214 |
| 214 private: | 215 private: |
| 215 void GoToOffset(int offset, const GURL& url, const PageState& state); | 216 void GoToOffset(int offset, const GURL& url, const PageState& state); |
| 216 }; | 217 }; |
| 217 | 218 |
| 218 } // namespace content | 219 } // namespace content |
| 219 | 220 |
| 220 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ | 221 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ |
| OLD | NEW |