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

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

Issue 145293007: ui: No more TestCompositor. Use NullDraw contexts in unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: testsnulldraw: Created 6 years, 10 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 | Annotate | Revision Log
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "content/browser/browser_thread_impl.h" 10 #include "content/browser/browser_thread_impl.h"
(...skipping 21 matching lines...) Expand all
32 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
33 #include "ui/events/keycodes/keyboard_codes.h" 33 #include "ui/events/keycodes/keyboard_codes.h"
34 #include "ui/gfx/canvas.h" 34 #include "ui/gfx/canvas.h"
35 #include "ui/gfx/screen.h" 35 #include "ui/gfx/screen.h"
36 36
37 #if defined(USE_AURA) 37 #if defined(USE_AURA)
38 #include "content/browser/compositor/image_transport_factory.h" 38 #include "content/browser/compositor/image_transport_factory.h"
39 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 39 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
40 #include "ui/aura/env.h" 40 #include "ui/aura/env.h"
41 #include "ui/aura/test/test_screen.h" 41 #include "ui/aura/test/test_screen.h"
42 #include "ui/compositor/test/test_context_factory.h" 42 #include "ui/compositor/test/in_process_context_factory.h"
43 #endif 43 #endif
44 44
45 #if defined(OS_WIN) || defined(USE_AURA) 45 #if defined(OS_WIN) || defined(USE_AURA)
46 #include "content/browser/renderer_host/ui_events_helper.h" 46 #include "content/browser/renderer_host/ui_events_helper.h"
47 #include "ui/events/event.h" 47 #include "ui/events/event.h"
48 #endif 48 #endif
49 49
50 using base::TimeDelta; 50 using base::TimeDelta;
51 using blink::WebGestureEvent; 51 using blink::WebGestureEvent;
52 using blink::WebInputEvent; 52 using blink::WebInputEvent;
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 } 614 }
615 615
616 protected: 616 protected:
617 // testing::Test 617 // testing::Test
618 virtual void SetUp() { 618 virtual void SetUp() {
619 browser_context_.reset(new TestBrowserContext()); 619 browser_context_.reset(new TestBrowserContext());
620 delegate_.reset(new MockRenderWidgetHostDelegate()); 620 delegate_.reset(new MockRenderWidgetHostDelegate());
621 process_ = new RenderWidgetHostProcess(browser_context_.get()); 621 process_ = new RenderWidgetHostProcess(browser_context_.get());
622 #if defined(USE_AURA) 622 #if defined(USE_AURA)
623 ImageTransportFactory::InitializeForUnitTests( 623 ImageTransportFactory::InitializeForUnitTests(
624 scoped_ptr<ui::ContextFactory>(new ui::TestContextFactory)); 624 scoped_ptr<ui::ContextFactory>(new ui::InProcessContextFactory));
625 aura::Env::CreateInstance(); 625 aura::Env::CreateInstance();
626 screen_.reset(aura::TestScreen::Create()); 626 screen_.reset(aura::TestScreen::Create());
627 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); 627 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get());
628 #endif 628 #endif
629 host_.reset( 629 host_.reset(
630 new MockRenderWidgetHost(delegate_.get(), process_, MSG_ROUTING_NONE)); 630 new MockRenderWidgetHost(delegate_.get(), process_, MSG_ROUTING_NONE));
631 view_.reset(new TestView(host_.get())); 631 view_.reset(new TestView(host_.get()));
632 host_->SetView(view_.get()); 632 host_->SetView(view_.get());
633 host_->Init(); 633 host_->Init();
634 } 634 }
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after
2616 2616
2617 // Tests RWHI::ForwardTouchEventWithLatencyInfo(). 2617 // Tests RWHI::ForwardTouchEventWithLatencyInfo().
2618 PressTouchPoint(0, 1); 2618 PressTouchPoint(0, 1);
2619 SendTouchEvent(); 2619 SendTouchEvent();
2620 CheckLatencyInfoComponentInMessage( 2620 CheckLatencyInfoComponentInMessage(
2621 process_, GetLatencyComponentId(), WebInputEvent::TouchStart); 2621 process_, GetLatencyComponentId(), WebInputEvent::TouchStart);
2622 SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); 2622 SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED);
2623 } 2623 }
2624 2624
2625 } // namespace content 2625 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698