Roll leveldb from r73 to r75.
[chromium-blink-merge.git] / ash / test / ash_test_helper_unittest.cc
blobfdb27f9e46b1822848d8f01e9bd18a5e5c8062f1
1 // Copyright 2013 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.
5 #include "ash/test/ash_test_helper.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/aura/root_window.h"
9 #include "ui/views/widget/widget.h"
11 // Tests for AshTestHelper. Who will watch the watchers? And who will test
12 // the tests?
13 class AshTestHelperTest : public testing::Test {
14 public:
15 AshTestHelperTest() {}
16 virtual ~AshTestHelperTest() {}
18 virtual void SetUp() OVERRIDE {
19 testing::Test::SetUp();
20 ash_test_helper_.reset(new ash::test::AshTestHelper(&message_loop_));
21 ash_test_helper_->SetUp();
24 virtual void TearDown() OVERRIDE {
25 ash_test_helper_->TearDown();
26 testing::Test::TearDown();
29 ash::test::AshTestHelper* ash_test_helper() {
30 return ash_test_helper_.get();
33 private:
34 base::MessageLoopForUI message_loop_;
35 scoped_ptr<ash::test::AshTestHelper> ash_test_helper_;
37 DISALLOW_COPY_AND_ASSIGN(AshTestHelperTest);
40 // Ensure that we have initialized enough of Ash to create and show a window.
41 TEST_F(AshTestHelperTest, AshTestHelper) {
42 // Check initial state.
43 EXPECT_TRUE(ash_test_helper()->message_loop());
44 EXPECT_TRUE(ash_test_helper()->test_shell_delegate());
45 EXPECT_TRUE(ash_test_helper()->CurrentContext());
47 // Enough state is initialized to create a window.
48 using views::Widget;
49 scoped_ptr<Widget> w1(new Widget);
50 Widget::InitParams params;
51 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
52 params.context = ash_test_helper()->CurrentContext();
53 w1->Init(params);
54 w1->Show();
55 EXPECT_TRUE(w1->IsActive());
56 EXPECT_TRUE(w1->IsVisible());