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" | |
10 #include "content/browser/renderer_host/backing_store.h" | 9 #include "content/browser/renderer_host/backing_store.h" |
11 #include "content/browser/renderer_host/test_render_view_host.h" | 10 #include "content/browser/renderer_host/test_render_view_host.h" |
12 #include "content/common/view_messages.h" | 11 #include "content/common/view_messages.h" |
| 12 #include "content/public/browser/content_browser_client.h" |
13 #include "content/public/browser/notification_details.h" | 13 #include "content/public/browser/notification_details.h" |
14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
16 #include "content/public/browser/notification_source.h" | 16 #include "content/public/browser/notification_source.h" |
17 #include "content/public/browser/notification_types.h" | 17 #include "content/public/browser/notification_types.h" |
18 #include "content/public/browser/content_browser_client.h" | |
19 #include "content/test/test_browser_context.h" | 18 #include "content/test/test_browser_context.h" |
| 19 #include "content/test/test_browser_thread.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "ui/base/keycodes/keyboard_codes.h" | 21 #include "ui/base/keycodes/keyboard_codes.h" |
22 #include "ui/gfx/canvas_skia.h" | 22 #include "ui/gfx/canvas_skia.h" |
23 | 23 |
24 using base::TimeDelta; | 24 using base::TimeDelta; |
25 | 25 |
26 using WebKit::WebInputEvent; | 26 using WebKit::WebInputEvent; |
27 using WebKit::WebMouseWheelEvent; | 27 using WebKit::WebMouseWheelEvent; |
28 | 28 |
29 namespace gfx { | 29 namespace gfx { |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 backing = host_->GetBackingStore(true); | 520 backing = host_->GetBackingStore(true); |
521 EXPECT_TRUE(backing); | 521 EXPECT_TRUE(backing); |
522 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID)); | 522 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID)); |
523 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching( | 523 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching( |
524 ViewMsg_UpdateRect_ACK::ID)); | 524 ViewMsg_UpdateRect_ACK::ID)); |
525 } | 525 } |
526 | 526 |
527 // Test that we don't paint when we're hidden, but we still send the ACK. Most | 527 // Test that we don't paint when we're hidden, but we still send the ACK. Most |
528 // of the rest of the painting is tested in the GetBackingStore* ones. | 528 // of the rest of the painting is tested in the GetBackingStore* ones. |
529 TEST_F(RenderWidgetHostTest, HiddenPaint) { | 529 TEST_F(RenderWidgetHostTest, HiddenPaint) { |
530 BrowserThread ui_thread(BrowserThread::UI, MessageLoop::current()); | 530 content::TestBrowserThread ui_thread(BrowserThread::UI, |
| 531 MessageLoop::current()); |
531 // Hide the widget, it should have sent out a message to the renderer. | 532 // Hide the widget, it should have sent out a message to the renderer. |
532 EXPECT_FALSE(host_->is_hidden_); | 533 EXPECT_FALSE(host_->is_hidden_); |
533 host_->WasHidden(); | 534 host_->WasHidden(); |
534 EXPECT_TRUE(host_->is_hidden_); | 535 EXPECT_TRUE(host_->is_hidden_); |
535 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_WasHidden::ID)); | 536 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_WasHidden::ID)); |
536 | 537 |
537 // Send it an update as from the renderer. | 538 // Send it an update as from the renderer. |
538 process_->sink().ClearMessages(); | 539 process_->sink().ClearMessages(); |
539 ViewHostMsg_UpdateRect_Params params; | 540 ViewHostMsg_UpdateRect_Params params; |
540 process_->InitUpdateRectParams(¶ms); | 541 process_->InitUpdateRectParams(¶ms); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 // Start it again to ensure it still works. | 736 // Start it again to ensure it still works. |
736 EXPECT_FALSE(host_->unresponsive_timer_fired()); | 737 EXPECT_FALSE(host_->unresponsive_timer_fired()); |
737 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); | 738 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); |
738 | 739 |
739 // Wait long enough for first timeout and see if it fired. | 740 // Wait long enough for first timeout and see if it fired. |
740 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 741 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
741 new MessageLoop::QuitTask(), 10); | 742 new MessageLoop::QuitTask(), 10); |
742 MessageLoop::current()->Run(); | 743 MessageLoop::current()->Run(); |
743 EXPECT_TRUE(host_->unresponsive_timer_fired()); | 744 EXPECT_TRUE(host_->unresponsive_timer_fired()); |
744 } | 745 } |
OLD | NEW |