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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 browser_context_.reset(new TestBrowserContext()); | 455 browser_context_.reset(new TestBrowserContext()); |
456 delegate_.reset(new MockRenderWidgetHostDelegate()); | 456 delegate_.reset(new MockRenderWidgetHostDelegate()); |
457 process_ = new RenderWidgetHostProcess(browser_context_.get()); | 457 process_ = new RenderWidgetHostProcess(browser_context_.get()); |
458 #if defined(USE_AURA) || (defined(OS_MACOSX) && !defined(OS_IOS)) | 458 #if defined(USE_AURA) || (defined(OS_MACOSX) && !defined(OS_IOS)) |
459 ImageTransportFactory::InitializeForUnitTests( | 459 ImageTransportFactory::InitializeForUnitTests( |
460 scoped_ptr<ImageTransportFactory>( | 460 scoped_ptr<ImageTransportFactory>( |
461 new NoTransportImageTransportFactory)); | 461 new NoTransportImageTransportFactory)); |
462 #endif | 462 #endif |
463 #if defined(USE_AURA) | 463 #if defined(USE_AURA) |
464 screen_.reset(aura::TestScreen::Create(gfx::Size())); | 464 screen_.reset(aura::TestScreen::Create(gfx::Size())); |
465 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); | 465 gfx::Screen::SetScreenInstance(screen_.get()); |
466 #endif | 466 #endif |
467 host_.reset(new MockRenderWidgetHost(delegate_.get(), process_, | 467 host_.reset(new MockRenderWidgetHost(delegate_.get(), process_, |
468 process_->GetNextRoutingID())); | 468 process_->GetNextRoutingID())); |
469 view_.reset(new TestView(host_.get())); | 469 view_.reset(new TestView(host_.get())); |
470 ConfigureView(view_.get()); | 470 ConfigureView(view_.get()); |
471 host_->SetView(view_.get()); | 471 host_->SetView(view_.get()); |
472 SetInitialRenderSizeParams(); | 472 SetInitialRenderSizeParams(); |
473 host_->Init(); | 473 host_->Init(); |
474 host_->DisableGestureDebounce(); | 474 host_->DisableGestureDebounce(); |
475 } | 475 } |
476 | 476 |
477 void TearDown() override { | 477 void TearDown() override { |
478 view_.reset(); | 478 view_.reset(); |
479 host_.reset(); | 479 host_.reset(); |
480 delegate_.reset(); | 480 delegate_.reset(); |
481 process_ = NULL; | 481 process_ = NULL; |
482 browser_context_.reset(); | 482 browser_context_.reset(); |
483 | 483 |
484 #if defined(USE_AURA) | 484 #if defined(USE_AURA) |
485 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, nullptr); | 485 gfx::Screen::SetScreenInstance(nullptr); |
486 screen_.reset(); | 486 screen_.reset(); |
487 #endif | 487 #endif |
488 #if defined(USE_AURA) || (defined(OS_MACOSX) && !defined(OS_IOS)) | 488 #if defined(USE_AURA) || (defined(OS_MACOSX) && !defined(OS_IOS)) |
489 ImageTransportFactory::Terminate(); | 489 ImageTransportFactory::Terminate(); |
490 #endif | 490 #endif |
491 | 491 |
492 // Process all pending tasks to avoid leaks. | 492 // Process all pending tasks to avoid leaks. |
493 base::MessageLoop::current()->RunUntilIdle(); | 493 base::MessageLoop::current()->RunUntilIdle(); |
494 } | 494 } |
495 | 495 |
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1670 ui::LatencyInfo()); | 1670 ui::LatencyInfo()); |
1671 | 1671 |
1672 | 1672 |
1673 // Tests RWHI::ForwardWheelEventWithLatencyInfo(). | 1673 // Tests RWHI::ForwardWheelEventWithLatencyInfo(). |
1674 SimulateWheelEventWithLatencyInfo(-5, 0, 0, true, ui::LatencyInfo()); | 1674 SimulateWheelEventWithLatencyInfo(-5, 0, 0, true, ui::LatencyInfo()); |
1675 | 1675 |
1676 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); | 1676 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); |
1677 } | 1677 } |
1678 | 1678 |
1679 } // namespace content | 1679 } // namespace content |
OLD | NEW |