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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
8 #include "base/timer.h" | 8 #include "base/timer.h" |
9 #include "content/browser/browser_thread_impl.h" | 9 #include "content/browser/browser_thread_impl.h" |
10 #include "content/browser/renderer_host/backing_store.h" | 10 #include "content/browser/renderer_host/backing_store.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 scoped_ptr<RenderWidgetHostView> view( | 431 scoped_ptr<RenderWidgetHostView> view( |
432 RenderWidgetHostView::CreateViewForWidget(host_.get())); | 432 RenderWidgetHostView::CreateViewForWidget(host_.get())); |
433 #if defined(USE_AURA) | 433 #if defined(USE_AURA) |
434 // TODO(derat): Call this on all platforms: http://crbug.com/102450. | 434 // TODO(derat): Call this on all platforms: http://crbug.com/102450. |
435 static_cast<RenderWidgetHostViewAura*>(view.get())->InitAsChild(NULL); | 435 static_cast<RenderWidgetHostViewAura*>(view.get())->InitAsChild(NULL); |
436 #endif | 436 #endif |
437 host_->SetView(view.get()); | 437 host_->SetView(view.get()); |
438 | 438 |
439 // Create a checkerboard background to test with. | 439 // Create a checkerboard background to test with. |
440 gfx::CanvasSkia canvas(gfx::Size(4, 4), true); | 440 gfx::CanvasSkia canvas(gfx::Size(4, 4), true); |
441 canvas.FillRect(SK_ColorBLACK, gfx::Rect(0, 0, 2, 2)); | 441 canvas.FillRect(gfx::Rect(0, 0, 2, 2), SK_ColorBLACK); |
442 canvas.FillRect(SK_ColorWHITE, gfx::Rect(2, 0, 2, 2)); | 442 canvas.FillRect(gfx::Rect(2, 0, 2, 2), SK_ColorWHITE); |
443 canvas.FillRect(SK_ColorWHITE, gfx::Rect(0, 2, 2, 2)); | 443 canvas.FillRect(gfx::Rect(0, 2, 2, 2), SK_ColorWHITE); |
444 canvas.FillRect(SK_ColorBLACK, gfx::Rect(2, 2, 2, 2)); | 444 canvas.FillRect(gfx::Rect(2, 2, 2, 2), SK_ColorBLACK); |
445 const SkBitmap& background = | 445 const SkBitmap& background = |
446 canvas.sk_canvas()->getDevice()->accessBitmap(false); | 446 canvas.sk_canvas()->getDevice()->accessBitmap(false); |
447 | 447 |
448 // Set the background and make sure we get back a copy. | 448 // Set the background and make sure we get back a copy. |
449 view->SetBackground(background); | 449 view->SetBackground(background); |
450 EXPECT_EQ(4, view->background().width()); | 450 EXPECT_EQ(4, view->background().width()); |
451 EXPECT_EQ(4, view->background().height()); | 451 EXPECT_EQ(4, view->background().height()); |
452 EXPECT_EQ(background.getSize(), view->background().getSize()); | 452 EXPECT_EQ(background.getSize(), view->background().getSize()); |
453 EXPECT_TRUE(0 == memcmp(background.getPixels(), | 453 EXPECT_TRUE(0 == memcmp(background.getPixels(), |
454 view->background().getPixels(), | 454 view->background().getPixels(), |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); | 759 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); |
760 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); | 760 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); |
761 SendInputEventACK(WebInputEvent::RawKeyDown, true); | 761 SendInputEventACK(WebInputEvent::RawKeyDown, true); |
762 | 762 |
763 // Wait long enough for first timeout and see if it fired. | 763 // Wait long enough for first timeout and see if it fired. |
764 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 764 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
765 MessageLoop::QuitClosure(), 40); | 765 MessageLoop::QuitClosure(), 40); |
766 MessageLoop::current()->Run(); | 766 MessageLoop::current()->Run(); |
767 EXPECT_TRUE(host_->unresponsive_timer_fired()); | 767 EXPECT_TRUE(host_->unresponsive_timer_fired()); |
768 } | 768 } |
OLD | NEW |