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

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

Issue 679243002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 InputEventAckState ack_result) override { 288 InputEventAckState ack_result) override {
289 gesture_event_type_ = event.type; 289 gesture_event_type_ = event.type;
290 ack_result_ = ack_result; 290 ack_result_ = ack_result;
291 } 291 }
292 gfx::Size GetPhysicalBackingSize() const override { 292 gfx::Size GetPhysicalBackingSize() const override {
293 if (use_fake_physical_backing_size_) 293 if (use_fake_physical_backing_size_)
294 return mock_physical_backing_size_; 294 return mock_physical_backing_size_;
295 return TestRenderWidgetHostView::GetPhysicalBackingSize(); 295 return TestRenderWidgetHostView::GetPhysicalBackingSize();
296 } 296 }
297 #if defined(USE_AURA) 297 #if defined(USE_AURA)
298 virtual ~TestView() { 298 ~TestView() override {
299 // Simulate the mouse exit event dispatched when an aura window is 299 // Simulate the mouse exit event dispatched when an aura window is
300 // destroyed. (MakeWebMouseEventFromAuraEvent translates ET_MOUSE_EXITED 300 // destroyed. (MakeWebMouseEventFromAuraEvent translates ET_MOUSE_EXITED
301 // into WebInputEvent::MouseMove.) 301 // into WebInputEvent::MouseMove.)
302 rwh_->input_router()->SendMouseEvent( 302 rwh_->input_router()->SendMouseEvent(
303 MouseEventWithLatencyInfo( 303 MouseEventWithLatencyInfo(
304 SyntheticWebMouseEventBuilder::Build(WebInputEvent::MouseMove), 304 SyntheticWebMouseEventBuilder::Build(WebInputEvent::MouseMove),
305 ui::LatencyInfo())); 305 ui::LatencyInfo()));
306 } 306 }
307 #endif 307 #endif
308 308
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 class RenderWidgetHostTest : public testing::Test { 400 class RenderWidgetHostTest : public testing::Test {
401 public: 401 public:
402 RenderWidgetHostTest() 402 RenderWidgetHostTest()
403 : process_(NULL), 403 : process_(NULL),
404 handle_key_press_event_(false), 404 handle_key_press_event_(false),
405 handle_mouse_event_(false), 405 handle_mouse_event_(false),
406 simulated_event_time_delta_seconds_(0) { 406 simulated_event_time_delta_seconds_(0) {
407 last_simulated_event_time_seconds_ = 407 last_simulated_event_time_seconds_ =
408 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); 408 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
409 } 409 }
410 virtual ~RenderWidgetHostTest() { 410 ~RenderWidgetHostTest() override {}
411 }
412 411
413 bool KeyPressEventCallback(const NativeWebKeyboardEvent& /* event */) { 412 bool KeyPressEventCallback(const NativeWebKeyboardEvent& /* event */) {
414 return handle_key_press_event_; 413 return handle_key_press_event_;
415 } 414 }
416 bool MouseEventCallback(const blink::WebMouseEvent& /* event */) { 415 bool MouseEventCallback(const blink::WebMouseEvent& /* event */) {
417 return handle_mouse_event_; 416 return handle_mouse_event_;
418 } 417 }
419 418
420 protected: 419 protected:
421 // testing::Test 420 // testing::Test
422 virtual void SetUp() { 421 void SetUp() override {
423 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 422 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
424 command_line->AppendSwitch(switches::kValidateInputEventStream); 423 command_line->AppendSwitch(switches::kValidateInputEventStream);
425 424
426 browser_context_.reset(new TestBrowserContext()); 425 browser_context_.reset(new TestBrowserContext());
427 delegate_.reset(new MockRenderWidgetHostDelegate()); 426 delegate_.reset(new MockRenderWidgetHostDelegate());
428 process_ = new RenderWidgetHostProcess(browser_context_.get()); 427 process_ = new RenderWidgetHostProcess(browser_context_.get());
429 #if defined(USE_AURA) || (defined(OS_MACOSX) && !defined(OS_IOS)) 428 #if defined(USE_AURA) || (defined(OS_MACOSX) && !defined(OS_IOS))
430 if (IsDelegatedRendererEnabled()) { 429 if (IsDelegatedRendererEnabled()) {
431 ImageTransportFactory::InitializeForUnitTests( 430 ImageTransportFactory::InitializeForUnitTests(
432 scoped_ptr<ImageTransportFactory>( 431 scoped_ptr<ImageTransportFactory>(
433 new NoTransportImageTransportFactory)); 432 new NoTransportImageTransportFactory));
434 } 433 }
435 #endif 434 #endif
436 #if defined(USE_AURA) 435 #if defined(USE_AURA)
437 aura::Env::CreateInstance(true); 436 aura::Env::CreateInstance(true);
438 screen_.reset(aura::TestScreen::Create(gfx::Size())); 437 screen_.reset(aura::TestScreen::Create(gfx::Size()));
439 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); 438 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get());
440 #endif 439 #endif
441 host_.reset( 440 host_.reset(
442 new MockRenderWidgetHost(delegate_.get(), process_, MSG_ROUTING_NONE)); 441 new MockRenderWidgetHost(delegate_.get(), process_, MSG_ROUTING_NONE));
443 view_.reset(new TestView(host_.get())); 442 view_.reset(new TestView(host_.get()));
444 host_->SetView(view_.get()); 443 host_->SetView(view_.get());
445 host_->Init(); 444 host_->Init();
446 host_->DisableGestureDebounce(); 445 host_->DisableGestureDebounce();
447 } 446 }
448 virtual void TearDown() { 447 void TearDown() override {
449 view_.reset(); 448 view_.reset();
450 host_.reset(); 449 host_.reset();
451 delegate_.reset(); 450 delegate_.reset();
452 process_ = NULL; 451 process_ = NULL;
453 browser_context_.reset(); 452 browser_context_.reset();
454 453
455 #if defined(USE_AURA) 454 #if defined(USE_AURA)
456 aura::Env::DeleteInstance(); 455 aura::Env::DeleteInstance();
457 screen_.reset(); 456 screen_.reset();
458 #endif 457 #endif
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 1488
1490 ASSERT_TRUE(host_->is_hidden()); 1489 ASSERT_TRUE(host_->is_hidden());
1491 host_->RendererExited(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); 1490 host_->RendererExited(base::TERMINATION_STATUS_PROCESS_CRASHED, -1);
1492 ASSERT_FALSE(host_->is_hidden()); 1491 ASSERT_FALSE(host_->is_hidden());
1493 1492
1494 // Make sure the input router is in a fresh state. 1493 // Make sure the input router is in a fresh state.
1495 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); 1494 ASSERT_FALSE(host_->input_router()->HasPendingEvents());
1496 } 1495 }
1497 1496
1498 } // namespace content 1497 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698