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

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

Issue 8122013: Allow CanvasSkia to bind to an existing SkCanvas. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 1 more fix Created 9 years, 2 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) 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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698