| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/scoped_ptr.h" | 6 #include "base/scoped_ptr.h" |
| 7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/renderer_host/backing_store.h" |
| 9 #include "chrome/browser/renderer_host/test_render_view_host.h" | 10 #include "chrome/browser/renderer_host/test_render_view_host.h" |
| 10 #include "chrome/common/render_messages.h" | 11 #include "chrome/common/render_messages.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 | 15 |
| 15 // RenderWidgetHostProcess ----------------------------------------------------- | 16 // RenderWidgetHostProcess ----------------------------------------------------- |
| 16 | 17 |
| 17 class RenderWidgetHostProcess : public MockRenderProcessHost { | 18 class RenderWidgetHostProcess : public MockRenderProcessHost { |
| 18 public: | 19 public: |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // Sets the bounds returned by GetViewBounds. | 103 // Sets the bounds returned by GetViewBounds. |
| 103 void set_bounds(const gfx::Rect& bounds) { | 104 void set_bounds(const gfx::Rect& bounds) { |
| 104 bounds_ = bounds; | 105 bounds_ = bounds; |
| 105 } | 106 } |
| 106 | 107 |
| 107 // RenderWidgetHostView override. | 108 // RenderWidgetHostView override. |
| 108 virtual gfx::Rect GetViewBounds() const { | 109 virtual gfx::Rect GetViewBounds() const { |
| 109 return bounds_; | 110 return bounds_; |
| 110 } | 111 } |
| 111 | 112 |
| 113 BackingStore* AllocBackingStore(const gfx::Size& size) { |
| 114 return new BackingStore(size); |
| 115 } |
| 116 |
| 112 protected: | 117 protected: |
| 113 gfx::Rect bounds_; | 118 gfx::Rect bounds_; |
| 114 DISALLOW_COPY_AND_ASSIGN(TestView); | 119 DISALLOW_COPY_AND_ASSIGN(TestView); |
| 115 }; | 120 }; |
| 116 | 121 |
| 117 // RenderWidgetHostTest -------------------------------------------------------- | 122 // RenderWidgetHostTest -------------------------------------------------------- |
| 118 | 123 |
| 119 class RenderWidgetHostTest : public testing::Test { | 124 class RenderWidgetHostTest : public testing::Test { |
| 120 public: | 125 public: |
| 121 RenderWidgetHostTest() : process_(NULL) { | 126 RenderWidgetHostTest() : process_(NULL) { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 EXPECT_FALSE(host_->is_hidden_); | 297 EXPECT_FALSE(host_->is_hidden_); |
| 293 | 298 |
| 294 // It should have sent out a restored message with a request to paint. | 299 // It should have sent out a restored message with a request to paint. |
| 295 const IPC::Message* restored = process_->sink().GetUniqueMessageMatching( | 300 const IPC::Message* restored = process_->sink().GetUniqueMessageMatching( |
| 296 ViewMsg_WasRestored::ID); | 301 ViewMsg_WasRestored::ID); |
| 297 ASSERT_TRUE(restored); | 302 ASSERT_TRUE(restored); |
| 298 bool needs_repaint; | 303 bool needs_repaint; |
| 299 ViewMsg_WasRestored::Read(restored, &needs_repaint); | 304 ViewMsg_WasRestored::Read(restored, &needs_repaint); |
| 300 EXPECT_TRUE(needs_repaint); | 305 EXPECT_TRUE(needs_repaint); |
| 301 } | 306 } |
| OLD | NEW |