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

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

Issue 7136001: GPU compositing surface handle is no longer sent to renderer process. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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 "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/test/testing_profile.h" 10 #include "chrome/test/testing_profile.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 ~RenderWidgetHostTest() { 253 ~RenderWidgetHostTest() {
254 } 254 }
255 255
256 protected: 256 protected:
257 // testing::Test 257 // testing::Test
258 void SetUp() { 258 void SetUp() {
259 profile_.reset(new TestingProfile()); 259 profile_.reset(new TestingProfile());
260 process_ = new RenderWidgetHostProcess(profile_.get()); 260 process_ = new RenderWidgetHostProcess(profile_.get());
261 host_.reset(new MockRenderWidgetHost(process_, 1)); 261 host_.reset(new MockRenderWidgetHost(process_, 1));
262 view_.reset(new TestView(host_.get())); 262 view_.reset(new TestView(host_.get()));
263 host_->set_view(view_.get()); 263 host_->SetView(view_.get());
264 host_->Init(); 264 host_->Init();
265 } 265 }
266 void TearDown() { 266 void TearDown() {
267 view_.reset(); 267 view_.reset();
268 host_.reset(); 268 host_.reset();
269 process_ = NULL; 269 process_ = NULL;
270 profile_.reset(); 270 profile_.reset();
271 271
272 // Process all pending tasks to avoid leaks. 272 // Process all pending tasks to avoid leaks.
273 MessageLoop::current()->RunAllPending(); 273 MessageLoop::current()->RunAllPending();
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 gfx::Rect original_size(0, 0, 100, 100); 409 gfx::Rect original_size(0, 0, 100, 100);
410 view_->set_bounds(original_size); 410 view_->set_bounds(original_size);
411 host_->WasResized(); 411 host_->WasResized();
412 EXPECT_TRUE(host_->resize_ack_pending_); 412 EXPECT_TRUE(host_->resize_ack_pending_);
413 EXPECT_EQ(original_size.size(), host_->in_flight_size_); 413 EXPECT_EQ(original_size.size(), host_->in_flight_size_);
414 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); 414 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID));
415 415
416 // Simulate a renderer crash before the update message. Ensure all the 416 // Simulate a renderer crash before the update message. Ensure all the
417 // resize ack logic is cleared. Must clear the view first so it doesn't get 417 // resize ack logic is cleared. Must clear the view first so it doesn't get
418 // deleted. 418 // deleted.
419 host_->set_view(NULL); 419 host_->SetView(NULL);
420 host_->RendererExited(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); 420 host_->RendererExited(base::TERMINATION_STATUS_PROCESS_CRASHED, -1);
421 EXPECT_FALSE(host_->resize_ack_pending_); 421 EXPECT_FALSE(host_->resize_ack_pending_);
422 EXPECT_EQ(gfx::Size(), host_->in_flight_size_); 422 EXPECT_EQ(gfx::Size(), host_->in_flight_size_);
423 423
424 // Reset the view so we can exit the test cleanly. 424 // Reset the view so we can exit the test cleanly.
425 host_->set_view(view_.get()); 425 host_->SetView(view_.get());
426 } 426 }
427 427
428 // Tests setting custom background 428 // Tests setting custom background
429 TEST_F(RenderWidgetHostTest, Background) { 429 TEST_F(RenderWidgetHostTest, Background) {
430 #if !defined(OS_MACOSX) 430 #if !defined(OS_MACOSX)
431 scoped_ptr<RenderWidgetHostView> view( 431 scoped_ptr<RenderWidgetHostView> view(
432 RenderWidgetHostView::CreateViewForWidget(host_.get())); 432 RenderWidgetHostView::CreateViewForWidget(host_.get()));
433 host_->set_view(view.get()); 433 host_->SetView(view.get());
434 434
435 // Create a checkerboard background to test with. 435 // Create a checkerboard background to test with.
436 gfx::CanvasSkia canvas(4, 4, true); 436 gfx::CanvasSkia canvas(4, 4, true);
437 canvas.FillRectInt(SK_ColorBLACK, 0, 0, 2, 2); 437 canvas.FillRectInt(SK_ColorBLACK, 0, 0, 2, 2);
438 canvas.FillRectInt(SK_ColorWHITE, 2, 0, 2, 2); 438 canvas.FillRectInt(SK_ColorWHITE, 2, 0, 2, 2);
439 canvas.FillRectInt(SK_ColorWHITE, 0, 2, 2, 2); 439 canvas.FillRectInt(SK_ColorWHITE, 0, 2, 2, 2);
440 canvas.FillRectInt(SK_ColorBLACK, 2, 2, 2, 2); 440 canvas.FillRectInt(SK_ColorBLACK, 2, 2, 2, 2);
441 const SkBitmap& background = canvas.getDevice()->accessBitmap(false); 441 const SkBitmap& background = canvas.getDevice()->accessBitmap(false);
442 442
443 // Set the background and make sure we get back a copy. 443 // Set the background and make sure we get back a copy.
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 // Start it again to ensure it still works. 728 // Start it again to ensure it still works.
729 EXPECT_FALSE(host_->unresponsive_timer_fired()); 729 EXPECT_FALSE(host_->unresponsive_timer_fired());
730 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); 730 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10));
731 731
732 // Wait long enough for first timeout and see if it fired. 732 // Wait long enough for first timeout and see if it fired.
733 MessageLoop::current()->PostDelayedTask(FROM_HERE, 733 MessageLoop::current()->PostDelayedTask(FROM_HERE,
734 new MessageLoop::QuitTask(), 10); 734 new MessageLoop::QuitTask(), 10);
735 MessageLoop::current()->Run(); 735 MessageLoop::current()->Run();
736 EXPECT_TRUE(host_->unresponsive_timer_fired()); 736 EXPECT_TRUE(host_->unresponsive_timer_fired());
737 } 737 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host.cc ('k') | content/browser/renderer_host/test_render_view_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698