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