Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | |
| 6 | |
| 7 #include "base/basictypes.h" | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "content/browser/renderer_host/test_render_view_host.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | |
| 11 #include "ui/aura/client/aura_constants.h" | |
| 12 #include "ui/aura/window.h" | |
| 13 #include "ui/base/ui_base_types.h" | |
| 14 | |
| 15 // This approach (of using RenderViewHostTestHarness's RenderViewHost for a new | |
| 16 // RenderWidgetHostView) is borrowed from RenderWidgetHostViewMacTest. | |
| 17 class RenderWidgetHostViewAuraTest : public RenderViewHostTestHarness { | |
|
Daniel Erat
2011/12/22 19:33:19
I could also believe that I should be testing this
| |
| 18 public: | |
| 19 RenderWidgetHostViewAuraTest() : old_rwhv_(NULL) {} | |
| 20 | |
| 21 virtual void SetUp() { | |
| 22 RenderViewHostTestHarness::SetUp(); | |
| 23 old_rwhv_ = rvh()->view(); | |
| 24 rwhv_aura_.reset(new RenderWidgetHostViewAura(rvh())); | |
| 25 } | |
| 26 | |
| 27 virtual void TearDown() { | |
| 28 aura::Window* window = rwhv_aura_->GetNativeView(); | |
| 29 if (window->parent()) | |
| 30 window->parent()->RemoveChild(window); | |
| 31 | |
| 32 rvh()->SetView(old_rwhv_); | |
| 33 rwhv_aura_.reset(); | |
| 34 RenderViewHostTestHarness::TearDown(); | |
| 35 } | |
| 36 | |
| 37 protected: | |
| 38 scoped_ptr<RenderWidgetHostViewAura> rwhv_aura_; | |
| 39 | |
| 40 private: | |
| 41 RenderWidgetHostView* old_rwhv_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAuraTest); | |
| 44 }; | |
| 45 | |
| 46 // Checks that a fullscreen view has the correct show-state and receives the | |
| 47 // focus. | |
| 48 TEST_F(RenderWidgetHostViewAuraTest, Fullscreen) { | |
| 49 rwhv_aura_->InitAsFullscreen(NULL); | |
| 50 | |
| 51 aura::Window* window = rwhv_aura_->GetNativeView(); | |
| 52 ASSERT_TRUE(window != NULL); | |
| 53 EXPECT_EQ(ui::SHOW_STATE_FULLSCREEN, | |
| 54 window->GetIntProperty(aura::client::kShowStateKey)); | |
| 55 | |
| 56 // Check that we requested and received the focus. | |
| 57 EXPECT_TRUE(window->HasFocus()); | |
| 58 | |
| 59 // Check that we'll also say it's okay to activate the window when there's an | |
| 60 // ActivationClient defined. | |
| 61 EXPECT_TRUE(rwhv_aura_->ShouldActivate(NULL)); | |
| 62 } | |
| OLD | NEW |