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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 class MockPaintingObserver : public NotificationObserver { 212 class MockPaintingObserver : public NotificationObserver {
213 public: 213 public:
214 void WidgetDidReceivePaintAtSizeAck(RenderWidgetHost* host, 214 void WidgetDidReceivePaintAtSizeAck(RenderWidgetHost* host,
215 int tag, 215 int tag,
216 const gfx::Size& size) { 216 const gfx::Size& size) {
217 host_ = reinterpret_cast<MockRenderWidgetHost*>(host); 217 host_ = reinterpret_cast<MockRenderWidgetHost*>(host);
218 tag_ = tag; 218 tag_ = tag;
219 size_ = size; 219 size_ = size;
220 } 220 }
221 221
222 void Observe(NotificationType type, 222 void Observe(int type,
223 const NotificationSource& source, 223 const NotificationSource& source,
224 const NotificationDetails& details) { 224 const NotificationDetails& details) {
225 if (type == 225 if (type ==
226 NotificationType::RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK) { 226 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK) {
227 RenderWidgetHost::PaintAtSizeAckDetails* size_ack_details = 227 RenderWidgetHost::PaintAtSizeAckDetails* size_ack_details =
228 Details<RenderWidgetHost::PaintAtSizeAckDetails>(details).ptr(); 228 Details<RenderWidgetHost::PaintAtSizeAckDetails>(details).ptr();
229 WidgetDidReceivePaintAtSizeAck( 229 WidgetDidReceivePaintAtSizeAck(
230 Source<RenderWidgetHost>(source).ptr(), 230 Source<RenderWidgetHost>(source).ptr(),
231 size_ack_details->tag, 231 size_ack_details->tag,
232 size_ack_details->size); 232 size_ack_details->size);
233 } 233 }
234 } 234 }
235 235
236 MockRenderWidgetHost* host() const { return host_; } 236 MockRenderWidgetHost* host() const { return host_; }
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 const int kPaintAtSizeTag = 42; 567 const int kPaintAtSizeTag = 42;
568 host_->PaintAtSize(TransportDIB::GetFakeHandleForTest(), kPaintAtSizeTag, 568 host_->PaintAtSize(TransportDIB::GetFakeHandleForTest(), kPaintAtSizeTag,
569 gfx::Size(40, 60), gfx::Size(20, 30)); 569 gfx::Size(40, 60), gfx::Size(20, 30));
570 EXPECT_TRUE( 570 EXPECT_TRUE(
571 process_->sink().GetUniqueMessageMatching(ViewMsg_PaintAtSize::ID)); 571 process_->sink().GetUniqueMessageMatching(ViewMsg_PaintAtSize::ID));
572 572
573 NotificationRegistrar registrar; 573 NotificationRegistrar registrar;
574 MockPaintingObserver observer; 574 MockPaintingObserver observer;
575 registrar.Add( 575 registrar.Add(
576 &observer, 576 &observer,
577 NotificationType::RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, 577 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK,
578 Source<RenderWidgetHost>(host_.get())); 578 Source<RenderWidgetHost>(host_.get()));
579 579
580 host_->OnMsgPaintAtSizeAck(kPaintAtSizeTag, gfx::Size(20, 30)); 580 host_->OnMsgPaintAtSizeAck(kPaintAtSizeTag, gfx::Size(20, 30));
581 EXPECT_EQ(host_.get(), observer.host()); 581 EXPECT_EQ(host_.get(), observer.host());
582 EXPECT_EQ(kPaintAtSizeTag, observer.tag()); 582 EXPECT_EQ(kPaintAtSizeTag, observer.tag());
583 EXPECT_EQ(20, observer.size().width()); 583 EXPECT_EQ(20, observer.size().width());
584 EXPECT_EQ(30, observer.size().height()); 584 EXPECT_EQ(30, observer.size().height());
585 } 585 }
586 586
587 TEST_F(RenderWidgetHostTest, HandleKeyEventsWeSent) { 587 TEST_F(RenderWidgetHostTest, HandleKeyEventsWeSent) {
(...skipping 140 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/resource_dispatcher_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698