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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 2773433003: Fix CompositorResizeLock to do something. (Closed)
Patch Set: resizelock: . Created 3 years, 9 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
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/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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <tuple> 10 #include <tuple>
(...skipping 29 matching lines...) Expand all
40 #include "content/browser/renderer_host/delegated_frame_host_client_aura.h" 40 #include "content/browser/renderer_host/delegated_frame_host_client_aura.h"
41 #include "content/browser/renderer_host/input/input_router.h" 41 #include "content/browser/renderer_host/input/input_router.h"
42 #include "content/browser/renderer_host/input/mouse_wheel_event_queue.h" 42 #include "content/browser/renderer_host/input/mouse_wheel_event_queue.h"
43 #include "content/browser/renderer_host/overscroll_controller.h" 43 #include "content/browser/renderer_host/overscroll_controller.h"
44 #include "content/browser/renderer_host/overscroll_controller_delegate.h" 44 #include "content/browser/renderer_host/overscroll_controller_delegate.h"
45 #include "content/browser/renderer_host/render_view_host_factory.h" 45 #include "content/browser/renderer_host/render_view_host_factory.h"
46 #include "content/browser/renderer_host/render_widget_host_delegate.h" 46 #include "content/browser/renderer_host/render_widget_host_delegate.h"
47 #include "content/browser/renderer_host/render_widget_host_impl.h" 47 #include "content/browser/renderer_host/render_widget_host_impl.h"
48 #include "content/browser/renderer_host/render_widget_host_view_event_handler.h" 48 #include "content/browser/renderer_host/render_widget_host_view_event_handler.h"
49 #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber .h" 49 #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber .h"
50 #include "content/browser/renderer_host/resize_lock.h"
51 #include "content/browser/renderer_host/text_input_manager.h" 50 #include "content/browser/renderer_host/text_input_manager.h"
52 #include "content/browser/web_contents/web_contents_view_aura.h" 51 #include "content/browser/web_contents/web_contents_view_aura.h"
53 #include "content/common/host_shared_bitmap_manager.h" 52 #include "content/common/host_shared_bitmap_manager.h"
54 #include "content/common/input/synthetic_web_input_event_builders.h" 53 #include "content/common/input/synthetic_web_input_event_builders.h"
55 #include "content/common/input_messages.h" 54 #include "content/common/input_messages.h"
56 #include "content/common/text_input_state.h" 55 #include "content/common/text_input_state.h"
57 #include "content/common/view_messages.h" 56 #include "content/common/view_messages.h"
58 #include "content/public/browser/render_widget_host_view.h" 57 #include "content/public/browser/render_widget_host_view.h"
59 #include "content/public/browser/web_contents_view_delegate.h" 58 #include "content/public/browser/web_contents_view_delegate.h"
60 #include "content/public/common/content_features.h" 59 #include "content/public/common/content_features.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 346
348 private: 347 private:
349 size_t processed_touch_event_count_; 348 size_t processed_touch_event_count_;
350 }; 349 };
351 350
352 class FakeDelegatedFrameHostClientAura : public DelegatedFrameHostClientAura { 351 class FakeDelegatedFrameHostClientAura : public DelegatedFrameHostClientAura {
353 public: 352 public:
354 explicit FakeDelegatedFrameHostClientAura( 353 explicit FakeDelegatedFrameHostClientAura(
355 RenderWidgetHostViewAura* render_widget_host_view) 354 RenderWidgetHostViewAura* render_widget_host_view)
356 : DelegatedFrameHostClientAura(render_widget_host_view) {} 355 : DelegatedFrameHostClientAura(render_widget_host_view) {}
357 ~FakeDelegatedFrameHostClientAura() override {} 356 ~FakeDelegatedFrameHostClientAura() override = default;
358 357
359 void DisableResizeLock() { can_create_resize_lock_ = false; } 358 void DisableResizeLock() { can_create_resize_lock_ = false; }
360 359
361 private: 360 private:
362 // A lock that doesn't actually do anything to the compositor, and does not 361 // DelegatedFrameHostClientAura implementation.
363 // time out.
364 class FakeResizeLock : public ResizeLock {
365 public:
366 FakeResizeLock(const gfx::Size new_size, bool defer_compositor_lock)
367 : ResizeLock(new_size, defer_compositor_lock) {}
368 };
369
370 // DelegatedFrameHostClientAura:
371 std::unique_ptr<ResizeLock> DelegatedFrameHostCreateResizeLock(
372 bool defer_compositor_lock) override {
373 gfx::Size desired_size =
374 render_widget_host_view()->GetNativeView()->bounds().size();
375 return std::unique_ptr<ResizeLock>(
376 new FakeResizeLock(desired_size, defer_compositor_lock));
377 }
378 bool DelegatedFrameCanCreateResizeLock() const override { 362 bool DelegatedFrameCanCreateResizeLock() const override {
379 return can_create_resize_lock_; 363 return can_create_resize_lock_;
380 } 364 }
381 365
382 bool can_create_resize_lock_ = true; 366 bool can_create_resize_lock_ = true;
383 367
384 DISALLOW_COPY_AND_ASSIGN(FakeDelegatedFrameHostClientAura); 368 DISALLOW_COPY_AND_ASSIGN(FakeDelegatedFrameHostClientAura);
385 }; 369 };
386 370
387 class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura { 371 class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura {
388 public: 372 public:
389 FakeRenderWidgetHostViewAura(RenderWidgetHost* widget, 373 FakeRenderWidgetHostViewAura(RenderWidgetHost* widget,
390 bool is_guest_view_hack) 374 bool is_guest_view_hack)
391 : RenderWidgetHostViewAura(widget, is_guest_view_hack), 375 : RenderWidgetHostViewAura(widget, is_guest_view_hack),
392 delegated_frame_host_client_( 376 delegated_frame_host_client_(
393 new FakeDelegatedFrameHostClientAura(this)) { 377 new FakeDelegatedFrameHostClientAura(this)) {
394 std::unique_ptr<DelegatedFrameHostClient> client( 378 InstallDelegatedFrameHostClient(
395 delegated_frame_host_client_); 379 this, base::WrapUnique(delegated_frame_host_client_));
396 InstallDelegatedFrameHostClient(this, std::move(client));
397 } 380 }
398 381
399 ~FakeRenderWidgetHostViewAura() override {} 382 ~FakeRenderWidgetHostViewAura() override {}
400 383
401 void DisableResizeLock() { 384 void DisableResizeLock() {
402 delegated_frame_host_client_->DisableResizeLock(); 385 delegated_frame_host_client_->DisableResizeLock();
403 } 386 }
404 387
405 void UseFakeDispatcher() { 388 void UseFakeDispatcher() {
406 dispatcher_ = new FakeWindowEventDispatcher(window()->GetHost()); 389 dispatcher_ = new FakeWindowEventDispatcher(window()->GetHost());
(...skipping 4600 matching lines...) Expand 10 before | Expand all | Expand 10 after
5007 // There is no composition in the beginning. 4990 // There is no composition in the beginning.
5008 EXPECT_FALSE(has_composition_text()); 4991 EXPECT_FALSE(has_composition_text());
5009 SetHasCompositionTextToTrue(); 4992 SetHasCompositionTextToTrue();
5010 view->ImeCancelComposition(); 4993 view->ImeCancelComposition();
5011 // The composition must have been canceled. 4994 // The composition must have been canceled.
5012 EXPECT_FALSE(has_composition_text()); 4995 EXPECT_FALSE(has_composition_text());
5013 } 4996 }
5014 } 4997 }
5015 4998
5016 } // namespace content 4999 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698