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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 size_t GetAndResetProcessedTouchEventCount() { | 348 size_t GetAndResetProcessedTouchEventCount() { |
349 size_t count = processed_touch_event_count_; | 349 size_t count = processed_touch_event_count_; |
350 processed_touch_event_count_ = 0; | 350 processed_touch_event_count_ = 0; |
351 return count; | 351 return count; |
352 } | 352 } |
353 | 353 |
354 private: | 354 private: |
355 size_t processed_touch_event_count_; | 355 size_t processed_touch_event_count_; |
356 }; | 356 }; |
357 | 357 |
358 class FakeDelegatedFrameHostClientAura : public DelegatedFrameHostClientAura { | 358 class FakeDelegatedFrameHostClientAura : public DelegatedFrameHostClientAura, |
| 359 public ui::CompositorLockDelegate { |
359 public: | 360 public: |
360 explicit FakeDelegatedFrameHostClientAura( | 361 explicit FakeDelegatedFrameHostClientAura( |
361 RenderWidgetHostViewAura* render_widget_host_view) | 362 RenderWidgetHostViewAura* render_widget_host_view) |
362 : DelegatedFrameHostClientAura(render_widget_host_view) {} | 363 : DelegatedFrameHostClientAura(render_widget_host_view), |
| 364 weak_ptr_factory_(this) {} |
363 ~FakeDelegatedFrameHostClientAura() override = default; | 365 ~FakeDelegatedFrameHostClientAura() override = default; |
364 | 366 |
365 void DisableResizeLock() { can_create_resize_lock_ = false; } | 367 void DisableResizeLock() { can_create_resize_lock_ = false; } |
366 | 368 |
| 369 bool resize_locked() const { return resize_locked_; } |
| 370 bool compositor_locked() const { return compositor_locked_; } |
| 371 |
367 private: | 372 private: |
368 // DelegatedFrameHostClientAura implementation. | 373 // DelegatedFrameHostClientAura implementation. |
369 bool DelegatedFrameCanCreateResizeLock() const override { | 374 bool DelegatedFrameCanCreateResizeLock() const override { |
370 return can_create_resize_lock_; | 375 return can_create_resize_lock_; |
371 } | 376 } |
372 | 377 |
373 // CompositorResizeLockClient implemention. Overrides from | 378 // CompositorResizeLockClient implemention. Overrides from |
374 // DelegatedFrameHostClientAura, to prevent the lock from timing out. | 379 // DelegatedFrameHostClientAura, to prevent the lock from timing out. |
375 std::unique_ptr<ui::CompositorLock> GetCompositorLock( | 380 std::unique_ptr<ui::CompositorLock> GetCompositorLock( |
376 ui::CompositorLockClient* client) override { | 381 ui::CompositorLockClient* client) override { |
377 return base::MakeUnique<ui::CompositorLock>(nullptr, nullptr); | 382 resize_locked_ = compositor_locked_ = true; |
| 383 return base::MakeUnique<ui::CompositorLock>(nullptr, |
| 384 weak_ptr_factory_.GetWeakPtr()); |
| 385 } |
| 386 // CompositorResizeLockClient implemention. Overrides from |
| 387 // // DelegatedFrameHostClientAura. |
| 388 void CompositorResizeLockEnded() override { |
| 389 resize_locked_ = false; |
| 390 DelegatedFrameHostClientAura::CompositorResizeLockEnded(); |
| 391 } |
| 392 |
| 393 // ui::CompositorLockDelegate implemention. |
| 394 void RemoveCompositorLock(ui::CompositorLock*) override { |
| 395 compositor_locked_ = false; |
378 } | 396 } |
379 | 397 |
380 bool can_create_resize_lock_ = true; | 398 bool can_create_resize_lock_ = true; |
| 399 bool resize_locked_ = false; |
| 400 bool compositor_locked_ = false; |
| 401 base::WeakPtrFactory<FakeDelegatedFrameHostClientAura> weak_ptr_factory_; |
381 | 402 |
382 DISALLOW_COPY_AND_ASSIGN(FakeDelegatedFrameHostClientAura); | 403 DISALLOW_COPY_AND_ASSIGN(FakeDelegatedFrameHostClientAura); |
383 }; | 404 }; |
384 | 405 |
385 class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura { | 406 class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura { |
386 public: | 407 public: |
387 FakeRenderWidgetHostViewAura(RenderWidgetHost* widget, | 408 FakeRenderWidgetHostViewAura(RenderWidgetHost* widget, |
388 bool is_guest_view_hack) | 409 bool is_guest_view_hack) |
389 : RenderWidgetHostViewAura(widget, is_guest_view_hack), | 410 : RenderWidgetHostViewAura(widget, is_guest_view_hack), |
390 delegated_frame_host_client_( | 411 delegated_frame_host_client_( |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 bool released_front_lock_active() const { | 456 bool released_front_lock_active() const { |
436 return GetDelegatedFrameHost()->ReleasedFrontLockActiveForTesting(); | 457 return GetDelegatedFrameHost()->ReleasedFrontLockActiveForTesting(); |
437 } | 458 } |
438 | 459 |
439 void ReclaimResources(const cc::ReturnedResourceArray& resources) { | 460 void ReclaimResources(const cc::ReturnedResourceArray& resources) { |
440 GetDelegatedFrameHost()->ReclaimResources(resources); | 461 GetDelegatedFrameHost()->ReclaimResources(resources); |
441 } | 462 } |
442 | 463 |
443 void ResetCompositor() { GetDelegatedFrameHost()->ResetCompositor(); } | 464 void ResetCompositor() { GetDelegatedFrameHost()->ResetCompositor(); } |
444 | 465 |
445 const ui::MotionEventAura& pointer_state_for_test() { | 466 const ui::MotionEventAura& pointer_state() { |
446 return event_handler()->pointer_state(); | 467 return event_handler()->pointer_state(); |
447 } | 468 } |
448 | 469 |
| 470 bool resize_locked() const { |
| 471 return delegated_frame_host_client_->resize_locked(); |
| 472 } |
| 473 bool compositor_locked() const { |
| 474 return delegated_frame_host_client_->compositor_locked(); |
| 475 } |
| 476 |
449 gfx::Size last_frame_size_; | 477 gfx::Size last_frame_size_; |
450 std::unique_ptr<cc::CopyOutputRequest> last_copy_request_; | 478 std::unique_ptr<cc::CopyOutputRequest> last_copy_request_; |
451 FakeWindowEventDispatcher* dispatcher_; | 479 FakeWindowEventDispatcher* dispatcher_; |
452 | 480 |
453 private: | 481 private: |
454 FakeDelegatedFrameHostClientAura* delegated_frame_host_client_; | 482 FakeDelegatedFrameHostClientAura* delegated_frame_host_client_; |
455 | 483 |
456 DISALLOW_COPY_AND_ASSIGN(FakeRenderWidgetHostViewAura); | 484 DISALLOW_COPY_AND_ASSIGN(FakeRenderWidgetHostViewAura); |
457 }; | 485 }; |
458 | 486 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 | 700 |
673 InputEventDispatchType dispatch_type = std::get<3>(params); | 701 InputEventDispatchType dispatch_type = std::get<3>(params); |
674 if (dispatch_type == InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING) | 702 if (dispatch_type == InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING) |
675 return; | 703 return; |
676 | 704 |
677 const blink::WebInputEvent* event = std::get<0>(params); | 705 const blink::WebInputEvent* event = std::get<0>(params); |
678 SendTouchEventACK(event->type(), ack_result, | 706 SendTouchEventACK(event->type(), ack_result, |
679 WebInputEventTraits::GetUniqueTouchEventId(*event)); | 707 WebInputEventTraits::GetUniqueTouchEventId(*event)); |
680 } | 708 } |
681 | 709 |
682 const ui::MotionEventAura& pointer_state() { | 710 const ui::MotionEventAura& pointer_state() { return view_->pointer_state(); } |
683 return view_->pointer_state_for_test(); | |
684 } | |
685 | 711 |
686 void EnableRafAlignedTouchInput() { | 712 void EnableRafAlignedTouchInput() { |
687 feature_list_.InitFromCommandLine( | 713 feature_list_.InitFromCommandLine( |
688 features::kRafAlignedTouchInputEvents.name, ""); | 714 features::kRafAlignedTouchInputEvents.name, ""); |
689 } | 715 } |
690 | 716 |
691 void DisableRafAlignedTouchInput() { | 717 void DisableRafAlignedTouchInput() { |
692 feature_list_.InitFromCommandLine( | 718 feature_list_.InitFromCommandLine( |
693 "", features::kRafAlignedTouchInputEvents.name); | 719 "", features::kRafAlignedTouchInputEvents.name); |
694 } | 720 } |
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2282 // A partial damage frame. | 2308 // A partial damage frame. |
2283 gfx::Rect partial_view_rect(30, 30, 20, 20); | 2309 gfx::Rect partial_view_rect(30, 30, 20, 20); |
2284 EXPECT_CALL(observer, | 2310 EXPECT_CALL(observer, |
2285 OnDelegatedFrameDamage(view_->window_, partial_view_rect)); | 2311 OnDelegatedFrameDamage(view_->window_, partial_view_rect)); |
2286 view_->SubmitCompositorFrame( | 2312 view_->SubmitCompositorFrame( |
2287 kArbitraryLocalSurfaceId, | 2313 kArbitraryLocalSurfaceId, |
2288 MakeDelegatedFrame(1.f, frame_size, partial_view_rect)); | 2314 MakeDelegatedFrame(1.f, frame_size, partial_view_rect)); |
2289 testing::Mock::VerifyAndClearExpectations(&observer); | 2315 testing::Mock::VerifyAndClearExpectations(&observer); |
2290 view_->RunOnCompositingDidCommit(); | 2316 view_->RunOnCompositingDidCommit(); |
2291 | 2317 |
| 2318 EXPECT_FALSE(view_->resize_locked()); |
| 2319 EXPECT_FALSE(view_->compositor_locked()); |
| 2320 |
2292 // Lock the compositor. Now we should drop frames. | 2321 // Lock the compositor. Now we should drop frames. |
2293 view_rect = gfx::Rect(150, 150); | 2322 view_rect = gfx::Rect(150, 150); |
2294 view_->SetSize(view_rect.size()); | 2323 view_->SetSize(view_rect.size()); |
| 2324 EXPECT_TRUE(view_->resize_locked()); |
| 2325 EXPECT_TRUE(view_->compositor_locked()); |
2295 | 2326 |
2296 // This frame is dropped. | 2327 // This frame is dropped. |
2297 gfx::Rect dropped_damage_rect_1(10, 20, 30, 40); | 2328 gfx::Rect dropped_damage_rect_1(10, 20, 30, 40); |
2298 EXPECT_CALL(observer, OnDelegatedFrameDamage(_, _)).Times(0); | 2329 EXPECT_CALL(observer, OnDelegatedFrameDamage(_, _)).Times(0); |
2299 view_->SubmitCompositorFrame( | 2330 view_->SubmitCompositorFrame( |
2300 kArbitraryLocalSurfaceId, | 2331 kArbitraryLocalSurfaceId, |
2301 MakeDelegatedFrame(1.f, frame_size, dropped_damage_rect_1)); | 2332 MakeDelegatedFrame(1.f, frame_size, dropped_damage_rect_1)); |
2302 testing::Mock::VerifyAndClearExpectations(&observer); | 2333 testing::Mock::VerifyAndClearExpectations(&observer); |
2303 view_->RunOnCompositingDidCommit(); | 2334 view_->RunOnCompositingDidCommit(); |
2304 | 2335 |
2305 gfx::Rect dropped_damage_rect_2(40, 50, 10, 20); | 2336 gfx::Rect dropped_damage_rect_2(40, 50, 10, 20); |
2306 EXPECT_CALL(observer, OnDelegatedFrameDamage(_, _)).Times(0); | 2337 EXPECT_CALL(observer, OnDelegatedFrameDamage(_, _)).Times(0); |
2307 view_->SubmitCompositorFrame( | 2338 view_->SubmitCompositorFrame( |
2308 kArbitraryLocalSurfaceId, | 2339 kArbitraryLocalSurfaceId, |
2309 MakeDelegatedFrame(1.f, frame_size, dropped_damage_rect_2)); | 2340 MakeDelegatedFrame(1.f, frame_size, dropped_damage_rect_2)); |
2310 testing::Mock::VerifyAndClearExpectations(&observer); | 2341 testing::Mock::VerifyAndClearExpectations(&observer); |
2311 view_->RunOnCompositingDidCommit(); | 2342 view_->RunOnCompositingDidCommit(); |
2312 | 2343 |
| 2344 EXPECT_TRUE(view_->resize_locked()); |
| 2345 EXPECT_TRUE(view_->compositor_locked()); |
| 2346 |
2313 // Unlock the compositor. This frame should damage everything. | 2347 // Unlock the compositor. This frame should damage everything. |
2314 frame_size = view_rect.size(); | 2348 frame_size = view_rect.size(); |
2315 | 2349 |
2316 gfx::Rect new_damage_rect(5, 6, 10, 10); | 2350 gfx::Rect new_damage_rect(5, 6, 10, 10); |
2317 EXPECT_CALL(observer, | 2351 EXPECT_CALL(observer, |
2318 OnDelegatedFrameDamage(view_->window_, view_rect)); | 2352 OnDelegatedFrameDamage(view_->window_, view_rect)); |
2319 view_->SubmitCompositorFrame( | 2353 view_->SubmitCompositorFrame( |
2320 kArbitraryLocalSurfaceId, | 2354 kArbitraryLocalSurfaceId, |
2321 MakeDelegatedFrame(1.f, frame_size, new_damage_rect)); | 2355 MakeDelegatedFrame(1.f, frame_size, new_damage_rect)); |
| 2356 // The swap unlocks the compositor. |
| 2357 EXPECT_TRUE(view_->resize_locked()); |
| 2358 EXPECT_FALSE(view_->compositor_locked()); |
2322 testing::Mock::VerifyAndClearExpectations(&observer); | 2359 testing::Mock::VerifyAndClearExpectations(&observer); |
| 2360 // The UI commit unlocks for further resize. |
2323 view_->RunOnCompositingDidCommit(); | 2361 view_->RunOnCompositingDidCommit(); |
| 2362 EXPECT_FALSE(view_->resize_locked()); |
| 2363 EXPECT_FALSE(view_->compositor_locked()); |
2324 | 2364 |
2325 // A partial damage frame, this should not be dropped. | 2365 // A partial damage frame, this should not be dropped. |
2326 EXPECT_CALL(observer, | 2366 EXPECT_CALL(observer, |
2327 OnDelegatedFrameDamage(view_->window_, partial_view_rect)); | 2367 OnDelegatedFrameDamage(view_->window_, partial_view_rect)); |
2328 view_->SubmitCompositorFrame( | 2368 view_->SubmitCompositorFrame( |
2329 kArbitraryLocalSurfaceId, | 2369 kArbitraryLocalSurfaceId, |
2330 MakeDelegatedFrame(1.f, frame_size, partial_view_rect)); | 2370 MakeDelegatedFrame(1.f, frame_size, partial_view_rect)); |
2331 testing::Mock::VerifyAndClearExpectations(&observer); | 2371 testing::Mock::VerifyAndClearExpectations(&observer); |
2332 view_->RunOnCompositingDidCommit(); | 2372 view_->RunOnCompositingDidCommit(); |
| 2373 EXPECT_FALSE(view_->resize_locked()); |
| 2374 EXPECT_FALSE(view_->compositor_locked()); |
2333 | 2375 |
2334 | 2376 // Resize to something empty. This doesn't lock anything since it's not |
2335 // Resize to something empty. | 2377 // visible anymore anyways. |
2336 view_rect = gfx::Rect(100, 0); | 2378 view_rect = gfx::Rect(100, 0); |
2337 view_->SetSize(view_rect.size()); | 2379 view_->SetSize(view_rect.size()); |
| 2380 EXPECT_FALSE(view_->resize_locked()); |
| 2381 EXPECT_FALSE(view_->compositor_locked()); |
2338 | 2382 |
2339 // We're never expecting empty frames, resize to something non-empty. | 2383 // We're never expecting empty frames, resize to something non-empty. |
2340 view_rect = gfx::Rect(100, 100); | 2384 view_rect = gfx::Rect(100, 100); |
2341 view_->SetSize(view_rect.size()); | 2385 view_->SetSize(view_rect.size()); |
| 2386 EXPECT_TRUE(view_->resize_locked()); |
| 2387 EXPECT_TRUE(view_->compositor_locked()); |
2342 | 2388 |
2343 // This frame should not be dropped. | 2389 // This frame should not be dropped. |
2344 EXPECT_CALL(observer, OnDelegatedFrameDamage(view_->window_, view_rect)); | 2390 EXPECT_CALL(observer, OnDelegatedFrameDamage(view_->window_, view_rect)); |
2345 view_->SubmitCompositorFrame( | 2391 view_->SubmitCompositorFrame( |
2346 kArbitraryLocalSurfaceId, | 2392 kArbitraryLocalSurfaceId, |
2347 MakeDelegatedFrame(1.f, view_rect.size(), view_rect)); | 2393 MakeDelegatedFrame(1.f, view_rect.size(), view_rect)); |
2348 testing::Mock::VerifyAndClearExpectations(&observer); | 2394 testing::Mock::VerifyAndClearExpectations(&observer); |
| 2395 EXPECT_TRUE(view_->resize_locked()); |
| 2396 EXPECT_FALSE(view_->compositor_locked()); |
2349 view_->RunOnCompositingDidCommit(); | 2397 view_->RunOnCompositingDidCommit(); |
| 2398 EXPECT_FALSE(view_->resize_locked()); |
| 2399 EXPECT_FALSE(view_->compositor_locked()); |
2350 | 2400 |
2351 view_->window_->RemoveObserver(&observer); | 2401 view_->window_->RemoveObserver(&observer); |
2352 } | 2402 } |
| 2403 |
| 2404 // If resize races with a renderer frame, we should lock for the right size. |
| 2405 TEST_F(RenderWidgetHostViewAuraTest, ResizeAfterReceivingFrame) { |
| 2406 gfx::Rect view_rect(100, 100); |
| 2407 gfx::Size frame_size = view_rect.size(); |
| 2408 |
| 2409 view_->InitAsChild(nullptr); |
| 2410 aura::client::ParentWindowWithContext( |
| 2411 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(), |
| 2412 gfx::Rect()); |
| 2413 view_->SetSize(view_rect.size()); |
| 2414 |
| 2415 MockWindowObserver observer; |
| 2416 view_->window_->AddObserver(&observer); |
| 2417 |
| 2418 // A frame of initial size. |
| 2419 EXPECT_CALL(observer, OnDelegatedFrameDamage(view_->window_, view_rect)); |
| 2420 view_->SubmitCompositorFrame( |
| 2421 kArbitraryLocalSurfaceId, |
| 2422 MakeDelegatedFrame(1.f, frame_size, gfx::Rect(frame_size))); |
| 2423 testing::Mock::VerifyAndClearExpectations(&observer); |
| 2424 view_->RunOnCompositingDidCommit(); |
| 2425 |
| 2426 // A frame of initial size arrives, but we don't commit in the UI yet. |
| 2427 EXPECT_CALL(observer, OnDelegatedFrameDamage(view_->window_, _)); |
| 2428 view_->SubmitCompositorFrame( |
| 2429 kArbitraryLocalSurfaceId, |
| 2430 MakeDelegatedFrame(1.f, frame_size, gfx::Rect(frame_size))); |
| 2431 testing::Mock::VerifyAndClearExpectations(&observer); |
| 2432 |
| 2433 EXPECT_FALSE(view_->resize_locked()); |
| 2434 EXPECT_FALSE(view_->compositor_locked()); |
| 2435 |
| 2436 // Resize, and lock the compositor. Now we should drop frames of the old size. |
| 2437 view_rect = gfx::Rect(150, 150); |
| 2438 view_->SetSize(view_rect.size()); |
| 2439 EXPECT_TRUE(view_->resize_locked()); |
| 2440 EXPECT_TRUE(view_->compositor_locked()); |
| 2441 |
| 2442 EXPECT_CALL(observer, OnDelegatedFrameDamage(_, _)).Times(0); |
| 2443 view_->SubmitCompositorFrame( |
| 2444 kArbitraryLocalSurfaceId, |
| 2445 MakeDelegatedFrame(1.f, frame_size, gfx::Rect(frame_size))); |
| 2446 testing::Mock::VerifyAndClearExpectations(&observer); |
| 2447 |
| 2448 // If the CompositorLock times out in the meantime, a commit would happen. |
| 2449 // Verify that if a commit occurs, the lock remains and we reject frames |
| 2450 // of the wrong size still. |
| 2451 view_->RunOnCompositingDidCommit(); |
| 2452 |
| 2453 EXPECT_TRUE(view_->resize_locked()); |
| 2454 // In this case we lied about it and the CompositorLock is still active. |
| 2455 EXPECT_TRUE(view_->compositor_locked()); |
| 2456 |
| 2457 EXPECT_CALL(observer, OnDelegatedFrameDamage(_, _)).Times(0); |
| 2458 view_->SubmitCompositorFrame( |
| 2459 kArbitraryLocalSurfaceId, |
| 2460 MakeDelegatedFrame(1.f, frame_size, gfx::Rect(frame_size))); |
| 2461 testing::Mock::VerifyAndClearExpectations(&observer); |
| 2462 |
| 2463 // A frame arrives of the new size, which will be accepted. |
| 2464 frame_size = view_rect.size(); |
| 2465 EXPECT_CALL(observer, OnDelegatedFrameDamage(view_->window_, _)); |
| 2466 view_->SubmitCompositorFrame( |
| 2467 kArbitraryLocalSurfaceId, |
| 2468 MakeDelegatedFrame(1.f, frame_size, gfx::Rect(frame_size))); |
| 2469 // Receiving the frame unlocks the compositor so it can commit. |
| 2470 EXPECT_TRUE(view_->resize_locked()); |
| 2471 EXPECT_FALSE(view_->compositor_locked()); |
| 2472 testing::Mock::VerifyAndClearExpectations(&observer); |
| 2473 |
| 2474 // When the frame of the correct size is committed, the CompositorResizeLock |
| 2475 // is released. |
| 2476 view_->RunOnCompositingDidCommit(); |
| 2477 EXPECT_FALSE(view_->resize_locked()); |
| 2478 EXPECT_FALSE(view_->compositor_locked()); |
| 2479 |
| 2480 view_->window_->RemoveObserver(&observer); |
| 2481 } |
2353 | 2482 |
2354 TEST_F(RenderWidgetHostViewAuraTest, OutputSurfaceIdChange) { | 2483 TEST_F(RenderWidgetHostViewAuraTest, OutputSurfaceIdChange) { |
2355 gfx::Rect view_rect(100, 100); | 2484 gfx::Rect view_rect(100, 100); |
2356 gfx::Size frame_size = view_rect.size(); | 2485 gfx::Size frame_size = view_rect.size(); |
2357 | 2486 |
2358 view_->InitAsChild(nullptr); | 2487 view_->InitAsChild(nullptr); |
2359 aura::client::ParentWindowWithContext( | 2488 aura::client::ParentWindowWithContext( |
2360 view_->GetNativeView(), | 2489 view_->GetNativeView(), |
2361 parent_view_->GetNativeView()->GetRootWindow(), | 2490 parent_view_->GetNativeView()->GetRootWindow(), |
2362 gfx::Rect()); | 2491 gfx::Rect()); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2423 | 2552 |
2424 // Create a bunch of renderers. | 2553 // Create a bunch of renderers. |
2425 for (size_t i = 0; i < renderer_count; ++i) { | 2554 for (size_t i = 0; i < renderer_count; ++i) { |
2426 int32_t routing_id = process_host_->GetNextRoutingID(); | 2555 int32_t routing_id = process_host_->GetNextRoutingID(); |
2427 delegates_.push_back(base::WrapUnique(new MockRenderWidgetHostDelegate)); | 2556 delegates_.push_back(base::WrapUnique(new MockRenderWidgetHostDelegate)); |
2428 hosts[i] = new RenderWidgetHostImpl(delegates_.back().get(), process_host_, | 2557 hosts[i] = new RenderWidgetHostImpl(delegates_.back().get(), process_host_, |
2429 routing_id, false); | 2558 routing_id, false); |
2430 delegates_.back()->set_widget_host(hosts[i]); | 2559 delegates_.back()->set_widget_host(hosts[i]); |
2431 hosts[i]->Init(); | 2560 hosts[i]->Init(); |
2432 views[i] = new FakeRenderWidgetHostViewAura(hosts[i], false); | 2561 views[i] = new FakeRenderWidgetHostViewAura(hosts[i], false); |
| 2562 // Prevent frames from being skipped due to resize, this test does not |
| 2563 // run a UI compositor so the DelegatedFrameHost doesn't get the chance |
| 2564 // to release its resize lock once it receives a frame of the expected |
| 2565 // size. |
| 2566 views[i]->DisableResizeLock(); |
2433 views[i]->InitAsChild(nullptr); | 2567 views[i]->InitAsChild(nullptr); |
2434 aura::client::ParentWindowWithContext( | 2568 aura::client::ParentWindowWithContext( |
2435 views[i]->GetNativeView(), | 2569 views[i]->GetNativeView(), |
2436 parent_view_->GetNativeView()->GetRootWindow(), | 2570 parent_view_->GetNativeView()->GetRootWindow(), |
2437 gfx::Rect()); | 2571 gfx::Rect()); |
2438 views[i]->SetSize(view_rect.size()); | 2572 views[i]->SetSize(view_rect.size()); |
2439 } | 2573 } |
2440 | 2574 |
2441 // Make each renderer visible, and swap a frame on it, then make it invisible. | 2575 // Make each renderer visible, and swap a frame on it, then make it invisible. |
2442 for (size_t i = 0; i < renderer_count; ++i) { | 2576 for (size_t i = 0; i < renderer_count; ++i) { |
(...skipping 2648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5091 // There is no composition in the beginning. | 5225 // There is no composition in the beginning. |
5092 EXPECT_FALSE(has_composition_text()); | 5226 EXPECT_FALSE(has_composition_text()); |
5093 SetHasCompositionTextToTrue(); | 5227 SetHasCompositionTextToTrue(); |
5094 view->ImeCancelComposition(); | 5228 view->ImeCancelComposition(); |
5095 // The composition must have been canceled. | 5229 // The composition must have been canceled. |
5096 EXPECT_FALSE(has_composition_text()); | 5230 EXPECT_FALSE(has_composition_text()); |
5097 } | 5231 } |
5098 } | 5232 } |
5099 | 5233 |
5100 } // namespace content | 5234 } // namespace content |
OLD | NEW |