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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 // TODO(derat): Call this on all platforms: http://crbug.com/102450. | 482 // TODO(derat): Call this on all platforms: http://crbug.com/102450. |
483 // InitAsChild doesn't seem to work if NULL parent is passed on Windows, | 483 // InitAsChild doesn't seem to work if NULL parent is passed on Windows, |
484 // which leads to DCHECK failure in RenderWidgetHostView::Destroy. | 484 // which leads to DCHECK failure in RenderWidgetHostView::Destroy. |
485 // When you enable this for OS_WIN, enable |view.release()->Destroy()| | 485 // When you enable this for OS_WIN, enable |view.release()->Destroy()| |
486 // below. | 486 // below. |
487 view->InitAsChild(NULL); | 487 view->InitAsChild(NULL); |
488 #endif | 488 #endif |
489 host_->SetView(view.get()); | 489 host_->SetView(view.get()); |
490 | 490 |
491 // Create a checkerboard background to test with. | 491 // Create a checkerboard background to test with. |
492 gfx::Canvas canvas(gfx::Size(4, 4), true); | 492 gfx::Canvas canvas(gfx::Size(4, 4), ui::SCALE_FACTOR_100P, true); |
493 canvas.FillRect(gfx::Rect(0, 0, 2, 2), SK_ColorBLACK); | 493 canvas.FillRect(gfx::Rect(0, 0, 2, 2), SK_ColorBLACK); |
494 canvas.FillRect(gfx::Rect(2, 0, 2, 2), SK_ColorWHITE); | 494 canvas.FillRect(gfx::Rect(2, 0, 2, 2), SK_ColorWHITE); |
495 canvas.FillRect(gfx::Rect(0, 2, 2, 2), SK_ColorWHITE); | 495 canvas.FillRect(gfx::Rect(0, 2, 2, 2), SK_ColorWHITE); |
496 canvas.FillRect(gfx::Rect(2, 2, 2, 2), SK_ColorBLACK); | 496 canvas.FillRect(gfx::Rect(2, 2, 2, 2), SK_ColorBLACK); |
497 const SkBitmap& background = | 497 const SkBitmap& background = |
498 canvas.sk_canvas()->getDevice()->accessBitmap(false); | 498 canvas.sk_canvas()->getDevice()->accessBitmap(false); |
499 | 499 |
500 // Set the background and make sure we get back a copy. | 500 // Set the background and make sure we get back a copy. |
501 view->SetBackground(background); | 501 view->SetBackground(background); |
502 EXPECT_EQ(4, view->GetBackground().width()); | 502 EXPECT_EQ(4, view->GetBackground().width()); |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); | 918 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); |
919 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); | 919 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); |
920 SendInputEventACK(WebInputEvent::RawKeyDown, true); | 920 SendInputEventACK(WebInputEvent::RawKeyDown, true); |
921 | 921 |
922 // Wait long enough for first timeout and see if it fired. | 922 // Wait long enough for first timeout and see if it fired. |
923 MessageLoop::current()->PostDelayedTask( | 923 MessageLoop::current()->PostDelayedTask( |
924 FROM_HERE, MessageLoop::QuitClosure(), TimeDelta::FromMilliseconds(40)); | 924 FROM_HERE, MessageLoop::QuitClosure(), TimeDelta::FromMilliseconds(40)); |
925 MessageLoop::current()->Run(); | 925 MessageLoop::current()->Run(); |
926 EXPECT_TRUE(host_->unresponsive_timer_fired()); | 926 EXPECT_TRUE(host_->unresponsive_timer_fired()); |
927 } | 927 } |
OLD | NEW |