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

Side by Side Diff: content/test/test_render_view_host.cc

Issue 2861533003: Backfill some UI tests. (Closed)
Patch Set: fix silent merge conflict Created 3 years, 7 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
« no previous file with comments | « content/test/test_render_view_host.h ('k') | ui/views/window/dialog_client_view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/test/test_render_view_host.h" 5 #include "content/test/test_render_view_host.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 12 matching lines...) Expand all
23 #include "content/public/browser/navigation_controller.h" 23 #include "content/public/browser/navigation_controller.h"
24 #include "content/public/browser/storage_partition.h" 24 #include "content/public/browser/storage_partition.h"
25 #include "content/public/common/content_client.h" 25 #include "content/public/common/content_client.h"
26 #include "content/public/common/page_state.h" 26 #include "content/public/common/page_state.h"
27 #include "content/public/common/web_preferences.h" 27 #include "content/public/common/web_preferences.h"
28 #include "content/test/test_render_frame_host.h" 28 #include "content/test/test_render_frame_host.h"
29 #include "content/test/test_web_contents.h" 29 #include "content/test/test_web_contents.h"
30 #include "media/base/video_frame.h" 30 #include "media/base/video_frame.h"
31 #include "ui/aura/env.h" 31 #include "ui/aura/env.h"
32 #include "ui/compositor/compositor.h" 32 #include "ui/compositor/compositor.h"
33 #include "ui/compositor/layer_type.h"
33 #include "ui/gfx/geometry/rect.h" 34 #include "ui/gfx/geometry/rect.h"
34 35
36 #if defined(USE_AURA)
37 #include "ui/aura/test/test_window_delegate.h"
38 #endif
39
35 namespace content { 40 namespace content {
36 41
37 void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params, 42 void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params,
38 int nav_entry_id, 43 int nav_entry_id,
39 bool did_create_new_entry, 44 bool did_create_new_entry,
40 const GURL& url, 45 const GURL& url,
41 ui::PageTransition transition) { 46 ui::PageTransition transition) {
42 params->nav_entry_id = nav_entry_id; 47 params->nav_entry_id = nav_entry_id;
43 params->url = url; 48 params->url = url;
44 params->origin = url::Origin(url); 49 params->origin = url::Origin(url);
(...skipping 21 matching lines...) Expand all
66 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); 71 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_);
67 #else 72 #else
68 // Not all tests initialize or need an image transport factory. 73 // Not all tests initialize or need an image transport factory.
69 if (ImageTransportFactory::GetInstance()) { 74 if (ImageTransportFactory::GetInstance()) {
70 frame_sink_id_ = AllocateFrameSinkId(); 75 frame_sink_id_ = AllocateFrameSinkId();
71 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); 76 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_);
72 } 77 }
73 #endif 78 #endif
74 79
75 rwh_->SetView(this); 80 rwh_->SetView(this);
81
82 #if defined(USE_AURA)
83 window_.reset(new aura::Window(
84 aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate()));
85 window_->set_owned_by_parent(false);
86 window_->Init(ui::LayerType::LAYER_NOT_DRAWN);
87 #endif
76 } 88 }
77 89
78 TestRenderWidgetHostView::~TestRenderWidgetHostView() { 90 TestRenderWidgetHostView::~TestRenderWidgetHostView() {
79 cc::SurfaceManager* manager = GetSurfaceManager(); 91 cc::SurfaceManager* manager = GetSurfaceManager();
80 if (manager) { 92 if (manager) {
81 manager->InvalidateFrameSinkId(frame_sink_id_); 93 manager->InvalidateFrameSinkId(frame_sink_id_);
82 } 94 }
83 } 95 }
84 96
85 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { 97 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const {
86 return rwh_; 98 return rwh_;
87 } 99 }
88 100
89 gfx::Vector2dF TestRenderWidgetHostView::GetLastScrollOffset() const { 101 gfx::Vector2dF TestRenderWidgetHostView::GetLastScrollOffset() const {
90 return gfx::Vector2dF(); 102 return gfx::Vector2dF();
91 } 103 }
92 104
93 gfx::NativeView TestRenderWidgetHostView::GetNativeView() const { 105 gfx::NativeView TestRenderWidgetHostView::GetNativeView() const {
106 #if defined(USE_AURA)
107 return window_.get();
108 #else
94 return nullptr; 109 return nullptr;
110 #endif
95 } 111 }
96 112
97 gfx::NativeViewAccessible TestRenderWidgetHostView::GetNativeViewAccessible() { 113 gfx::NativeViewAccessible TestRenderWidgetHostView::GetNativeViewAccessible() {
98 return nullptr; 114 return nullptr;
99 } 115 }
100 116
101 ui::TextInputClient* TestRenderWidgetHostView::GetTextInputClient() { 117 ui::TextInputClient* TestRenderWidgetHostView::GetTextInputClient() {
102 return &text_input_client_; 118 return &text_input_client_;
103 } 119 }
104 120
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 335
320 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { 336 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() {
321 return contents()->GetMainFrame(); 337 return contents()->GetMainFrame();
322 } 338 }
323 339
324 TestWebContents* RenderViewHostImplTestHarness::contents() { 340 TestWebContents* RenderViewHostImplTestHarness::contents() {
325 return static_cast<TestWebContents*>(web_contents()); 341 return static_cast<TestWebContents*>(web_contents());
326 } 342 }
327 343
328 } // namespace content 344 } // namespace content
OLDNEW
« no previous file with comments | « content/test/test_render_view_host.h ('k') | ui/views/window/dialog_client_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698