| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/browser/renderer_host/test_render_view_host.h" | 9 #include "content/browser/renderer_host/test_render_view_host.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "ui/aura/client/aura_constants.h" | 11 #include "ui/aura/client/aura_constants.h" |
| 12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
| 13 #include "ui/base/ui_base_types.h" | 13 #include "ui/base/ui_base_types.h" |
| 14 | 14 |
| 15 using content::RenderWidgetHostView; | 15 using content::RenderWidgetHostView; |
| 16 | 16 |
| 17 // This approach (of using RenderViewHostTestHarness's RenderViewHost for a new | 17 // This approach (of using RenderViewHostTestHarness's RenderViewHost for a new |
| 18 // RenderWidgetHostView) is borrowed from RenderWidgetHostViewMacTest. | 18 // RenderWidgetHostView) is borrowed from RenderWidgetHostViewMacTest. |
| 19 class RenderWidgetHostViewAuraTest : public RenderViewHostTestHarness { | 19 class RenderWidgetHostViewAuraTest : public RenderViewHostTestHarness { |
| 20 public: | 20 public: |
| 21 RenderWidgetHostViewAuraTest() : old_rwhv_(NULL) {} | 21 RenderWidgetHostViewAuraTest() : old_rwhv_(NULL) {} |
| 22 | 22 |
| 23 virtual void SetUp() { | 23 virtual void SetUp() { |
| 24 RenderViewHostTestHarness::SetUp(); | 24 RenderViewHostTestHarness::SetUp(); |
| 25 old_rwhv_ = rvh()->view(); | 25 old_rwhv_ = rvh()->GetView(); |
| 26 rwhv_aura_ = static_cast<RenderWidgetHostViewAura*>( | 26 rwhv_aura_ = static_cast<RenderWidgetHostViewAura*>( |
| 27 RenderWidgetHostView::CreateViewForWidget(rvh())); | 27 RenderWidgetHostView::CreateViewForWidget(rvh())); |
| 28 } | 28 } |
| 29 | 29 |
| 30 virtual void TearDown() { | 30 virtual void TearDown() { |
| 31 aura::Window* window = rwhv_aura_->GetNativeView(); | 31 aura::Window* window = rwhv_aura_->GetNativeView(); |
| 32 if (window->parent()) | 32 if (window->parent()) |
| 33 window->parent()->RemoveChild(window); | 33 window->parent()->RemoveChild(window); |
| 34 rwhv_aura_->Destroy(); | 34 rwhv_aura_->Destroy(); |
| 35 // Destroying RWHV sets the host's view to NULL, so destroying view first, | 35 // Destroying RWHV sets the host's view to NULL, so destroying view first, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 57 EXPECT_EQ(ui::SHOW_STATE_FULLSCREEN, | 57 EXPECT_EQ(ui::SHOW_STATE_FULLSCREEN, |
| 58 window->GetProperty(aura::client::kShowStateKey)); | 58 window->GetProperty(aura::client::kShowStateKey)); |
| 59 | 59 |
| 60 // Check that we requested and received the focus. | 60 // Check that we requested and received the focus. |
| 61 EXPECT_TRUE(window->HasFocus()); | 61 EXPECT_TRUE(window->HasFocus()); |
| 62 | 62 |
| 63 // Check that we'll also say it's okay to activate the window when there's an | 63 // Check that we'll also say it's okay to activate the window when there's an |
| 64 // ActivationClient defined. | 64 // ActivationClient defined. |
| 65 EXPECT_TRUE(rwhv_aura_->ShouldActivate(NULL)); | 65 EXPECT_TRUE(rwhv_aura_->ShouldActivate(NULL)); |
| 66 } | 66 } |
| OLD | NEW |