OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 9 #include "content/browser/browser_thread.h" |
10 #include "content/browser/renderer_host/backing_store.h" | 10 #include "content/browser/renderer_host/backing_store.h" |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 scoped_ptr<RenderWidgetHostView> view( | 424 scoped_ptr<RenderWidgetHostView> view( |
425 RenderWidgetHostView::CreateViewForWidget(host_.get())); | 425 RenderWidgetHostView::CreateViewForWidget(host_.get())); |
426 host_->SetView(view.get()); | 426 host_->SetView(view.get()); |
427 | 427 |
428 // Create a checkerboard background to test with. | 428 // Create a checkerboard background to test with. |
429 gfx::CanvasSkia canvas(4, 4, true); | 429 gfx::CanvasSkia canvas(4, 4, true); |
430 canvas.FillRectInt(SK_ColorBLACK, 0, 0, 2, 2); | 430 canvas.FillRectInt(SK_ColorBLACK, 0, 0, 2, 2); |
431 canvas.FillRectInt(SK_ColorWHITE, 2, 0, 2, 2); | 431 canvas.FillRectInt(SK_ColorWHITE, 2, 0, 2, 2); |
432 canvas.FillRectInt(SK_ColorWHITE, 0, 2, 2, 2); | 432 canvas.FillRectInt(SK_ColorWHITE, 0, 2, 2, 2); |
433 canvas.FillRectInt(SK_ColorBLACK, 2, 2, 2, 2); | 433 canvas.FillRectInt(SK_ColorBLACK, 2, 2, 2, 2); |
434 const SkBitmap& background = canvas.getDevice()->accessBitmap(false); | 434 const SkBitmap& background = |
| 435 canvas.sk_canvas()->getDevice()->accessBitmap(false); |
435 | 436 |
436 // Set the background and make sure we get back a copy. | 437 // Set the background and make sure we get back a copy. |
437 view->SetBackground(background); | 438 view->SetBackground(background); |
438 EXPECT_EQ(4, view->background().width()); | 439 EXPECT_EQ(4, view->background().width()); |
439 EXPECT_EQ(4, view->background().height()); | 440 EXPECT_EQ(4, view->background().height()); |
440 EXPECT_EQ(background.getSize(), view->background().getSize()); | 441 EXPECT_EQ(background.getSize(), view->background().getSize()); |
441 EXPECT_TRUE(0 == memcmp(background.getPixels(), | 442 EXPECT_TRUE(0 == memcmp(background.getPixels(), |
442 view->background().getPixels(), | 443 view->background().getPixels(), |
443 background.getSize())); | 444 background.getSize())); |
444 | 445 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 // Start it again to ensure it still works. | 722 // Start it again to ensure it still works. |
722 EXPECT_FALSE(host_->unresponsive_timer_fired()); | 723 EXPECT_FALSE(host_->unresponsive_timer_fired()); |
723 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); | 724 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); |
724 | 725 |
725 // Wait long enough for first timeout and see if it fired. | 726 // Wait long enough for first timeout and see if it fired. |
726 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 727 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
727 new MessageLoop::QuitTask(), 10); | 728 new MessageLoop::QuitTask(), 10); |
728 MessageLoop::current()->Run(); | 729 MessageLoop::current()->Run(); |
729 EXPECT_TRUE(host_->unresponsive_timer_fired()); | 730 EXPECT_TRUE(host_->unresponsive_timer_fired()); |
730 } | 731 } |
OLD | NEW |