| 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/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 using blink::WebTouchPoint; | 67 using blink::WebTouchPoint; |
| 68 | 68 |
| 69 namespace content { | 69 namespace content { |
| 70 namespace { | 70 namespace { |
| 71 | 71 |
| 72 // Simple screen position client to test coordinate system conversion. | 72 // Simple screen position client to test coordinate system conversion. |
| 73 class TestScreenPositionClient | 73 class TestScreenPositionClient |
| 74 : public aura::client::ScreenPositionClient { | 74 : public aura::client::ScreenPositionClient { |
| 75 public: | 75 public: |
| 76 TestScreenPositionClient() {} | 76 TestScreenPositionClient() {} |
| 77 virtual ~TestScreenPositionClient() {} | 77 ~TestScreenPositionClient() override {} |
| 78 | 78 |
| 79 // aura::client::ScreenPositionClient overrides: | 79 // aura::client::ScreenPositionClient overrides: |
| 80 virtual void ConvertPointToScreen(const aura::Window* window, | 80 void ConvertPointToScreen(const aura::Window* window, |
| 81 gfx::Point* point) override { | 81 gfx::Point* point) override { |
| 82 point->Offset(-1, -1); | 82 point->Offset(-1, -1); |
| 83 } | 83 } |
| 84 | 84 |
| 85 virtual void ConvertPointFromScreen(const aura::Window* window, | 85 void ConvertPointFromScreen(const aura::Window* window, |
| 86 gfx::Point* point) override { | 86 gfx::Point* point) override { |
| 87 point->Offset(1, 1); | 87 point->Offset(1, 1); |
| 88 } | 88 } |
| 89 | 89 |
| 90 virtual void ConvertHostPointToScreen(aura::Window* window, | 90 void ConvertHostPointToScreen(aura::Window* window, |
| 91 gfx::Point* point) override { | 91 gfx::Point* point) override { |
| 92 ConvertPointToScreen(window, point); | 92 ConvertPointToScreen(window, point); |
| 93 } | 93 } |
| 94 | 94 |
| 95 virtual void SetBounds(aura::Window* window, | 95 void SetBounds(aura::Window* window, |
| 96 const gfx::Rect& bounds, | 96 const gfx::Rect& bounds, |
| 97 const gfx::Display& display) override { | 97 const gfx::Display& display) override {} |
| 98 } | |
| 99 }; | 98 }; |
| 100 | 99 |
| 101 class TestOverscrollDelegate : public OverscrollControllerDelegate { | 100 class TestOverscrollDelegate : public OverscrollControllerDelegate { |
| 102 public: | 101 public: |
| 103 explicit TestOverscrollDelegate(RenderWidgetHostView* view) | 102 explicit TestOverscrollDelegate(RenderWidgetHostView* view) |
| 104 : view_(view), | 103 : view_(view), |
| 105 current_mode_(OVERSCROLL_NONE), | 104 current_mode_(OVERSCROLL_NONE), |
| 106 completed_mode_(OVERSCROLL_NONE), | 105 completed_mode_(OVERSCROLL_NONE), |
| 107 delta_x_(0.f), | 106 delta_x_(0.f), |
| 108 delta_y_(0.f) {} | 107 delta_y_(0.f) {} |
| 109 | 108 |
| 110 virtual ~TestOverscrollDelegate() {} | 109 ~TestOverscrollDelegate() override {} |
| 111 | 110 |
| 112 OverscrollMode current_mode() const { return current_mode_; } | 111 OverscrollMode current_mode() const { return current_mode_; } |
| 113 OverscrollMode completed_mode() const { return completed_mode_; } | 112 OverscrollMode completed_mode() const { return completed_mode_; } |
| 114 float delta_x() const { return delta_x_; } | 113 float delta_x() const { return delta_x_; } |
| 115 float delta_y() const { return delta_y_; } | 114 float delta_y() const { return delta_y_; } |
| 116 | 115 |
| 117 void Reset() { | 116 void Reset() { |
| 118 current_mode_ = OVERSCROLL_NONE; | 117 current_mode_ = OVERSCROLL_NONE; |
| 119 completed_mode_ = OVERSCROLL_NONE; | 118 completed_mode_ = OVERSCROLL_NONE; |
| 120 delta_x_ = delta_y_ = 0.f; | 119 delta_x_ = delta_y_ = 0.f; |
| 121 } | 120 } |
| 122 | 121 |
| 123 private: | 122 private: |
| 124 // Overridden from OverscrollControllerDelegate: | 123 // Overridden from OverscrollControllerDelegate: |
| 125 virtual gfx::Rect GetVisibleBounds() const override { | 124 gfx::Rect GetVisibleBounds() const override { |
| 126 return view_->IsShowing() ? view_->GetViewBounds() : gfx::Rect(); | 125 return view_->IsShowing() ? view_->GetViewBounds() : gfx::Rect(); |
| 127 } | 126 } |
| 128 | 127 |
| 129 virtual bool OnOverscrollUpdate(float delta_x, float delta_y) override { | 128 bool OnOverscrollUpdate(float delta_x, float delta_y) override { |
| 130 delta_x_ = delta_x; | 129 delta_x_ = delta_x; |
| 131 delta_y_ = delta_y; | 130 delta_y_ = delta_y; |
| 132 return true; | 131 return true; |
| 133 } | 132 } |
| 134 | 133 |
| 135 virtual void OnOverscrollComplete(OverscrollMode overscroll_mode) override { | 134 void OnOverscrollComplete(OverscrollMode overscroll_mode) override { |
| 136 EXPECT_EQ(current_mode_, overscroll_mode); | 135 EXPECT_EQ(current_mode_, overscroll_mode); |
| 137 completed_mode_ = overscroll_mode; | 136 completed_mode_ = overscroll_mode; |
| 138 current_mode_ = OVERSCROLL_NONE; | 137 current_mode_ = OVERSCROLL_NONE; |
| 139 } | 138 } |
| 140 | 139 |
| 141 virtual void OnOverscrollModeChange(OverscrollMode old_mode, | 140 void OnOverscrollModeChange(OverscrollMode old_mode, |
| 142 OverscrollMode new_mode) override { | 141 OverscrollMode new_mode) override { |
| 143 EXPECT_EQ(current_mode_, old_mode); | 142 EXPECT_EQ(current_mode_, old_mode); |
| 144 current_mode_ = new_mode; | 143 current_mode_ = new_mode; |
| 145 delta_x_ = delta_y_ = 0.f; | 144 delta_x_ = delta_y_ = 0.f; |
| 146 } | 145 } |
| 147 | 146 |
| 148 RenderWidgetHostView* view_; | 147 RenderWidgetHostView* view_; |
| 149 OverscrollMode current_mode_; | 148 OverscrollMode current_mode_; |
| 150 OverscrollMode completed_mode_; | 149 OverscrollMode completed_mode_; |
| 151 float delta_x_; | 150 float delta_x_; |
| 152 float delta_y_; | 151 float delta_y_; |
| 153 | 152 |
| 154 DISALLOW_COPY_AND_ASSIGN(TestOverscrollDelegate); | 153 DISALLOW_COPY_AND_ASSIGN(TestOverscrollDelegate); |
| 155 }; | 154 }; |
| 156 | 155 |
| 157 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { | 156 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { |
| 158 public: | 157 public: |
| 159 MockRenderWidgetHostDelegate() {} | 158 MockRenderWidgetHostDelegate() {} |
| 160 virtual ~MockRenderWidgetHostDelegate() {} | 159 ~MockRenderWidgetHostDelegate() override {} |
| 161 }; | 160 }; |
| 162 | 161 |
| 163 // Simple observer that keeps track of changes to a window for tests. | 162 // Simple observer that keeps track of changes to a window for tests. |
| 164 class TestWindowObserver : public aura::WindowObserver { | 163 class TestWindowObserver : public aura::WindowObserver { |
| 165 public: | 164 public: |
| 166 explicit TestWindowObserver(aura::Window* window_to_observe) | 165 explicit TestWindowObserver(aura::Window* window_to_observe) |
| 167 : window_(window_to_observe) { | 166 : window_(window_to_observe) { |
| 168 window_->AddObserver(this); | 167 window_->AddObserver(this); |
| 169 } | 168 } |
| 170 virtual ~TestWindowObserver() { | 169 ~TestWindowObserver() override { |
| 171 if (window_) | 170 if (window_) |
| 172 window_->RemoveObserver(this); | 171 window_->RemoveObserver(this); |
| 173 } | 172 } |
| 174 | 173 |
| 175 bool destroyed() const { return destroyed_; } | 174 bool destroyed() const { return destroyed_; } |
| 176 | 175 |
| 177 // aura::WindowObserver overrides: | 176 // aura::WindowObserver overrides: |
| 178 virtual void OnWindowDestroyed(aura::Window* window) override { | 177 void OnWindowDestroyed(aura::Window* window) override { |
| 179 CHECK_EQ(window, window_); | 178 CHECK_EQ(window, window_); |
| 180 destroyed_ = true; | 179 destroyed_ = true; |
| 181 window_ = NULL; | 180 window_ = NULL; |
| 182 } | 181 } |
| 183 | 182 |
| 184 private: | 183 private: |
| 185 // Window that we're observing, or NULL if it's been destroyed. | 184 // Window that we're observing, or NULL if it's been destroyed. |
| 186 aura::Window* window_; | 185 aura::Window* window_; |
| 187 | 186 |
| 188 // Was |window_| destroyed? | 187 // Was |window_| destroyed? |
| 189 bool destroyed_; | 188 bool destroyed_; |
| 190 | 189 |
| 191 DISALLOW_COPY_AND_ASSIGN(TestWindowObserver); | 190 DISALLOW_COPY_AND_ASSIGN(TestWindowObserver); |
| 192 }; | 191 }; |
| 193 | 192 |
| 194 class FakeFrameSubscriber : public RenderWidgetHostViewFrameSubscriber { | 193 class FakeFrameSubscriber : public RenderWidgetHostViewFrameSubscriber { |
| 195 public: | 194 public: |
| 196 FakeFrameSubscriber(gfx::Size size, base::Callback<void(bool)> callback) | 195 FakeFrameSubscriber(gfx::Size size, base::Callback<void(bool)> callback) |
| 197 : size_(size), callback_(callback) {} | 196 : size_(size), callback_(callback) {} |
| 198 | 197 |
| 199 virtual bool ShouldCaptureFrame(const gfx::Rect& damage_rect, | 198 bool ShouldCaptureFrame(const gfx::Rect& damage_rect, |
| 200 base::TimeTicks present_time, | 199 base::TimeTicks present_time, |
| 201 scoped_refptr<media::VideoFrame>* storage, | 200 scoped_refptr<media::VideoFrame>* storage, |
| 202 DeliverFrameCallback* callback) override { | 201 DeliverFrameCallback* callback) override { |
| 203 *storage = media::VideoFrame::CreateFrame(media::VideoFrame::YV12, | 202 *storage = media::VideoFrame::CreateFrame(media::VideoFrame::YV12, |
| 204 size_, | 203 size_, |
| 205 gfx::Rect(size_), | 204 gfx::Rect(size_), |
| 206 size_, | 205 size_, |
| 207 base::TimeDelta()); | 206 base::TimeDelta()); |
| 208 *callback = base::Bind(&FakeFrameSubscriber::CallbackMethod, callback_); | 207 *callback = base::Bind(&FakeFrameSubscriber::CallbackMethod, callback_); |
| 209 return true; | 208 return true; |
| 210 } | 209 } |
| 211 | 210 |
| 212 static void CallbackMethod(base::Callback<void(bool)> callback, | 211 static void CallbackMethod(base::Callback<void(bool)> callback, |
| 213 base::TimeTicks timestamp, | 212 base::TimeTicks timestamp, |
| 214 bool success) { | 213 bool success) { |
| 215 callback.Run(success); | 214 callback.Run(success); |
| 216 } | 215 } |
| 217 | 216 |
| 218 private: | 217 private: |
| 219 gfx::Size size_; | 218 gfx::Size size_; |
| 220 base::Callback<void(bool)> callback_; | 219 base::Callback<void(bool)> callback_; |
| 221 }; | 220 }; |
| 222 | 221 |
| 223 class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura { | 222 class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura { |
| 224 public: | 223 public: |
| 225 FakeRenderWidgetHostViewAura(RenderWidgetHost* widget, | 224 FakeRenderWidgetHostViewAura(RenderWidgetHost* widget, |
| 226 bool is_guest_view_hack) | 225 bool is_guest_view_hack) |
| 227 : RenderWidgetHostViewAura(widget, is_guest_view_hack), | 226 : RenderWidgetHostViewAura(widget, is_guest_view_hack), |
| 228 has_resize_lock_(false) {} | 227 has_resize_lock_(false) {} |
| 229 | 228 |
| 230 virtual ~FakeRenderWidgetHostViewAura() {} | 229 ~FakeRenderWidgetHostViewAura() override {} |
| 231 | 230 |
| 232 virtual scoped_ptr<ResizeLock> CreateResizeLock( | 231 scoped_ptr<ResizeLock> CreateResizeLock(bool defer_compositor_lock) override { |
| 233 bool defer_compositor_lock) override { | |
| 234 gfx::Size desired_size = window()->bounds().size(); | 232 gfx::Size desired_size = window()->bounds().size(); |
| 235 return scoped_ptr<ResizeLock>( | 233 return scoped_ptr<ResizeLock>( |
| 236 new FakeResizeLock(desired_size, defer_compositor_lock)); | 234 new FakeResizeLock(desired_size, defer_compositor_lock)); |
| 237 } | 235 } |
| 238 | 236 |
| 239 void RunOnCompositingDidCommit() { | 237 void RunOnCompositingDidCommit() { |
| 240 GetDelegatedFrameHost()->OnCompositingDidCommitForTesting( | 238 GetDelegatedFrameHost()->OnCompositingDidCommitForTesting( |
| 241 window()->GetHost()->compositor()); | 239 window()->GetHost()->compositor()); |
| 242 } | 240 } |
| 243 | 241 |
| 244 virtual bool ShouldCreateResizeLock() override { | 242 bool ShouldCreateResizeLock() override { |
| 245 return GetDelegatedFrameHost()->ShouldCreateResizeLockForTesting(); | 243 return GetDelegatedFrameHost()->ShouldCreateResizeLockForTesting(); |
| 246 } | 244 } |
| 247 | 245 |
| 248 virtual void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request) | 246 void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request) override { |
| 249 override { | |
| 250 last_copy_request_ = request.Pass(); | 247 last_copy_request_ = request.Pass(); |
| 251 if (last_copy_request_->has_texture_mailbox()) { | 248 if (last_copy_request_->has_texture_mailbox()) { |
| 252 // Give the resulting texture a size. | 249 // Give the resulting texture a size. |
| 253 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); | 250 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); |
| 254 GLuint texture = gl_helper->ConsumeMailboxToTexture( | 251 GLuint texture = gl_helper->ConsumeMailboxToTexture( |
| 255 last_copy_request_->texture_mailbox().mailbox(), | 252 last_copy_request_->texture_mailbox().mailbox(), |
| 256 last_copy_request_->texture_mailbox().sync_point()); | 253 last_copy_request_->texture_mailbox().sync_point()); |
| 257 gl_helper->ResizeTexture(texture, window()->bounds().size()); | 254 gl_helper->ResizeTexture(texture, window()->bounds().size()); |
| 258 gl_helper->DeleteTexture(texture); | 255 gl_helper->DeleteTexture(texture); |
| 259 } | 256 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 285 | 282 |
| 286 bool has_resize_lock_; | 283 bool has_resize_lock_; |
| 287 gfx::Size last_frame_size_; | 284 gfx::Size last_frame_size_; |
| 288 scoped_ptr<cc::CopyOutputRequest> last_copy_request_; | 285 scoped_ptr<cc::CopyOutputRequest> last_copy_request_; |
| 289 }; | 286 }; |
| 290 | 287 |
| 291 // A layout manager that always resizes a child to the root window size. | 288 // A layout manager that always resizes a child to the root window size. |
| 292 class FullscreenLayoutManager : public aura::LayoutManager { | 289 class FullscreenLayoutManager : public aura::LayoutManager { |
| 293 public: | 290 public: |
| 294 explicit FullscreenLayoutManager(aura::Window* owner) : owner_(owner) {} | 291 explicit FullscreenLayoutManager(aura::Window* owner) : owner_(owner) {} |
| 295 virtual ~FullscreenLayoutManager() {} | 292 ~FullscreenLayoutManager() override {} |
| 296 | 293 |
| 297 // Overridden from aura::LayoutManager: | 294 // Overridden from aura::LayoutManager: |
| 298 virtual void OnWindowResized() override { | 295 void OnWindowResized() override { |
| 299 aura::Window::Windows::const_iterator i; | 296 aura::Window::Windows::const_iterator i; |
| 300 for (i = owner_->children().begin(); i != owner_->children().end(); ++i) { | 297 for (i = owner_->children().begin(); i != owner_->children().end(); ++i) { |
| 301 (*i)->SetBounds(gfx::Rect()); | 298 (*i)->SetBounds(gfx::Rect()); |
| 302 } | 299 } |
| 303 } | 300 } |
| 304 virtual void OnWindowAddedToLayout(aura::Window* child) override { | 301 void OnWindowAddedToLayout(aura::Window* child) override { |
| 305 child->SetBounds(gfx::Rect()); | 302 child->SetBounds(gfx::Rect()); |
| 306 } | 303 } |
| 307 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) override {} | 304 void OnWillRemoveWindowFromLayout(aura::Window* child) override {} |
| 308 virtual void OnWindowRemovedFromLayout(aura::Window* child) override {} | 305 void OnWindowRemovedFromLayout(aura::Window* child) override {} |
| 309 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 306 void OnChildWindowVisibilityChanged(aura::Window* child, |
| 310 bool visible) override {} | 307 bool visible) override {} |
| 311 virtual void SetChildBounds(aura::Window* child, | 308 void SetChildBounds(aura::Window* child, |
| 312 const gfx::Rect& requested_bounds) override { | 309 const gfx::Rect& requested_bounds) override { |
| 313 SetChildBoundsDirect(child, gfx::Rect(owner_->bounds().size())); | 310 SetChildBoundsDirect(child, gfx::Rect(owner_->bounds().size())); |
| 314 } | 311 } |
| 315 | 312 |
| 316 private: | 313 private: |
| 317 aura::Window* owner_; | 314 aura::Window* owner_; |
| 318 DISALLOW_COPY_AND_ASSIGN(FullscreenLayoutManager); | 315 DISALLOW_COPY_AND_ASSIGN(FullscreenLayoutManager); |
| 319 }; | 316 }; |
| 320 | 317 |
| 321 class MockWindowObserver : public aura::WindowObserver { | 318 class MockWindowObserver : public aura::WindowObserver { |
| 322 public: | 319 public: |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 delete parent_host_; | 373 delete parent_host_; |
| 377 | 374 |
| 378 browser_context_.reset(); | 375 browser_context_.reset(); |
| 379 aura_test_helper_->TearDown(); | 376 aura_test_helper_->TearDown(); |
| 380 | 377 |
| 381 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); | 378 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); |
| 382 message_loop_.RunUntilIdle(); | 379 message_loop_.RunUntilIdle(); |
| 383 ImageTransportFactory::Terminate(); | 380 ImageTransportFactory::Terminate(); |
| 384 } | 381 } |
| 385 | 382 |
| 386 virtual void SetUp() override { SetUpEnvironment(); } | 383 void SetUp() override { SetUpEnvironment(); } |
| 387 | 384 |
| 388 virtual void TearDown() override { TearDownEnvironment(); } | 385 void TearDown() override { TearDownEnvironment(); } |
| 389 | 386 |
| 390 void set_widget_host_uses_shutdown_to_destroy(bool use) { | 387 void set_widget_host_uses_shutdown_to_destroy(bool use) { |
| 391 widget_host_uses_shutdown_to_destroy_ = use; | 388 widget_host_uses_shutdown_to_destroy_ = use; |
| 392 } | 389 } |
| 393 | 390 |
| 394 protected: | 391 protected: |
| 395 // If true, then calls RWH::Shutdown() instead of deleting RWH. | 392 // If true, then calls RWH::Shutdown() instead of deleting RWH. |
| 396 bool widget_host_uses_shutdown_to_destroy_; | 393 bool widget_host_uses_shutdown_to_destroy_; |
| 397 | 394 |
| 398 bool is_guest_view_hack_; | 395 bool is_guest_view_hack_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 425 class RenderWidgetHostViewGuestAuraTest : public RenderWidgetHostViewAuraTest { | 422 class RenderWidgetHostViewGuestAuraTest : public RenderWidgetHostViewAuraTest { |
| 426 public: | 423 public: |
| 427 RenderWidgetHostViewGuestAuraTest() { | 424 RenderWidgetHostViewGuestAuraTest() { |
| 428 // Use RWH::Shutdown to destroy RWH, instead of deleting. | 425 // Use RWH::Shutdown to destroy RWH, instead of deleting. |
| 429 // This will ensure that the RenderWidgetHostViewGuest is not leaked and | 426 // This will ensure that the RenderWidgetHostViewGuest is not leaked and |
| 430 // is deleted properly upon RWH going away. | 427 // is deleted properly upon RWH going away. |
| 431 set_widget_host_uses_shutdown_to_destroy(true); | 428 set_widget_host_uses_shutdown_to_destroy(true); |
| 432 } | 429 } |
| 433 | 430 |
| 434 // We explicitly invoke SetUp to allow gesture debounce customization. | 431 // We explicitly invoke SetUp to allow gesture debounce customization. |
| 435 virtual void SetUp() { | 432 void SetUp() override { |
| 436 is_guest_view_hack_ = true; | 433 is_guest_view_hack_ = true; |
| 437 | 434 |
| 438 RenderWidgetHostViewAuraTest::SetUp(); | 435 RenderWidgetHostViewAuraTest::SetUp(); |
| 439 | 436 |
| 440 guest_view_weak_ = (new RenderWidgetHostViewGuest( | 437 guest_view_weak_ = (new RenderWidgetHostViewGuest( |
| 441 widget_host_, NULL, view_->GetWeakPtr()))->GetWeakPtr(); | 438 widget_host_, NULL, view_->GetWeakPtr()))->GetWeakPtr(); |
| 442 } | 439 } |
| 443 | 440 |
| 444 virtual void TearDown() { | 441 void TearDown() override { |
| 445 // Internal override to do nothing, we clean up ourselves in the test body. | 442 // Internal override to do nothing, we clean up ourselves in the test body. |
| 446 // This helps us test that |guest_view_weak_| does not leak. | 443 // This helps us test that |guest_view_weak_| does not leak. |
| 447 } | 444 } |
| 448 | 445 |
| 449 protected: | 446 protected: |
| 450 base::WeakPtr<RenderWidgetHostViewBase> guest_view_weak_; | 447 base::WeakPtr<RenderWidgetHostViewBase> guest_view_weak_; |
| 451 | 448 |
| 452 private: | 449 private: |
| 453 | 450 |
| 454 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuestAuraTest); | 451 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuestAuraTest); |
| 455 }; | 452 }; |
| 456 | 453 |
| 457 class RenderWidgetHostViewAuraOverscrollTest | 454 class RenderWidgetHostViewAuraOverscrollTest |
| 458 : public RenderWidgetHostViewAuraTest { | 455 : public RenderWidgetHostViewAuraTest { |
| 459 public: | 456 public: |
| 460 RenderWidgetHostViewAuraOverscrollTest() {} | 457 RenderWidgetHostViewAuraOverscrollTest() {} |
| 461 | 458 |
| 462 // We explicitly invoke SetUp to allow gesture debounce customization. | 459 // We explicitly invoke SetUp to allow gesture debounce customization. |
| 463 virtual void SetUp() {} | 460 void SetUp() override {} |
| 464 | 461 |
| 465 protected: | 462 protected: |
| 466 void SetUpOverscrollEnvironmentWithDebounce(int debounce_interval_in_ms) { | 463 void SetUpOverscrollEnvironmentWithDebounce(int debounce_interval_in_ms) { |
| 467 SetUpOverscrollEnvironmentImpl(debounce_interval_in_ms); | 464 SetUpOverscrollEnvironmentImpl(debounce_interval_in_ms); |
| 468 } | 465 } |
| 469 | 466 |
| 470 void SetUpOverscrollEnvironment() { SetUpOverscrollEnvironmentImpl(0); } | 467 void SetUpOverscrollEnvironment() { SetUpOverscrollEnvironmentImpl(0); } |
| 471 | 468 |
| 472 void SetUpOverscrollEnvironmentImpl(int debounce_interval_in_ms) { | 469 void SetUpOverscrollEnvironmentImpl(int debounce_interval_in_ms) { |
| 473 ui::GestureConfiguration::set_scroll_debounce_interval_in_ms( | 470 ui::GestureConfiguration::set_scroll_debounce_interval_in_ms( |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 | 670 |
| 674 private: | 671 private: |
| 675 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAuraOverscrollTest); | 672 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAuraOverscrollTest); |
| 676 }; | 673 }; |
| 677 | 674 |
| 678 class RenderWidgetHostViewAuraShutdownTest | 675 class RenderWidgetHostViewAuraShutdownTest |
| 679 : public RenderWidgetHostViewAuraTest { | 676 : public RenderWidgetHostViewAuraTest { |
| 680 public: | 677 public: |
| 681 RenderWidgetHostViewAuraShutdownTest() {} | 678 RenderWidgetHostViewAuraShutdownTest() {} |
| 682 | 679 |
| 683 virtual void TearDown() override { | 680 void TearDown() override { |
| 684 // No TearDownEnvironment here, we do this explicitly during the test. | 681 // No TearDownEnvironment here, we do this explicitly during the test. |
| 685 } | 682 } |
| 686 | 683 |
| 687 private: | 684 private: |
| 688 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAuraShutdownTest); | 685 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAuraShutdownTest); |
| 689 }; | 686 }; |
| 690 | 687 |
| 691 // Checks that a fullscreen view has the correct show-state and receives the | 688 // Checks that a fullscreen view has the correct show-state and receives the |
| 692 // focus. | 689 // focus. |
| 693 TEST_F(RenderWidgetHostViewAuraTest, FocusFullscreen) { | 690 TEST_F(RenderWidgetHostViewAuraTest, FocusFullscreen) { |
| (...skipping 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2907 } | 2904 } |
| 2908 | 2905 |
| 2909 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted | 2906 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted |
| 2910 // before RWH), we clean up properly and don't leak the RWHVGuest. | 2907 // before RWH), we clean up properly and don't leak the RWHVGuest. |
| 2911 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) { | 2908 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) { |
| 2912 TearDownEnvironment(); | 2909 TearDownEnvironment(); |
| 2913 ASSERT_FALSE(guest_view_weak_.get()); | 2910 ASSERT_FALSE(guest_view_weak_.get()); |
| 2914 } | 2911 } |
| 2915 | 2912 |
| 2916 } // namespace content | 2913 } // namespace content |
| OLD | NEW |