Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: ash/test/ash_test_helper_unittest.cc

Issue 2298323002: Makes chrome data_dep specific to chromeos (Closed)
Patch Set: revert synced to tip of tree Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/test/ash_test_helper.cc ('k') | ash/test/ash_test_views_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 "ash/test/ash_test_helper.h" 5 #include "ash/test/ash_test_helper.h"
6 6
7 #include "ash/test/ash_test_environment.h"
7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/aura/window_event_dispatcher.h" 9 #include "ui/aura/window_event_dispatcher.h"
9 #include "ui/views/widget/widget.h" 10 #include "ui/views/widget/widget.h"
10 11
11 #if defined(OS_WIN) 12 namespace ash {
12 #include "base/win/windows_version.h"
13 #endif
14 13
15 // Tests for AshTestHelper. Who will watch the watchers? And who will test 14 // Tests for AshTestHelper. Who will watch the watchers? And who will test
16 // the tests? 15 // the tests?
17 class AshTestHelperTest : public testing::Test { 16 class AshTestHelperTest : public testing::Test {
18 public: 17 public:
19 AshTestHelperTest() {} 18 AshTestHelperTest() {}
20 ~AshTestHelperTest() override {} 19 ~AshTestHelperTest() override {}
21 20
22 void SetUp() override { 21 void SetUp() override {
23 testing::Test::SetUp(); 22 testing::Test::SetUp();
24 ash_test_helper_.reset(new ash::test::AshTestHelper(&message_loop_)); 23 ash_test_environment_ = test::AshTestEnvironment::Create();
24 ash_test_helper_.reset(
25 new test::AshTestHelper(ash_test_environment_.get()));
25 ash_test_helper_->SetUp(true, 26 ash_test_helper_->SetUp(true,
26 ash::MaterialDesignController::Mode::UNINITIALIZED); 27 MaterialDesignController::Mode::UNINITIALIZED);
27 } 28 }
28 29
29 void TearDown() override { 30 void TearDown() override {
30 ash_test_helper_->TearDown(); 31 ash_test_helper_->TearDown();
31 testing::Test::TearDown(); 32 testing::Test::TearDown();
32 } 33 }
33 34
34 ash::test::AshTestHelper* ash_test_helper() { return ash_test_helper_.get(); } 35 test::AshTestHelper* ash_test_helper() { return ash_test_helper_.get(); }
36
37 protected:
38 std::unique_ptr<test::AshTestEnvironment> ash_test_environment_;
35 39
36 private: 40 private:
37 base::MessageLoopForUI message_loop_; 41 std::unique_ptr<test::AshTestHelper> ash_test_helper_;
38 std::unique_ptr<ash::test::AshTestHelper> ash_test_helper_;
39 42
40 DISALLOW_COPY_AND_ASSIGN(AshTestHelperTest); 43 DISALLOW_COPY_AND_ASSIGN(AshTestHelperTest);
41 }; 44 };
42 45
43 // Ensure that we have initialized enough of Ash to create and show a window. 46 // Ensure that we have initialized enough of Ash to create and show a window.
44 TEST_F(AshTestHelperTest, AshTestHelper) { 47 TEST_F(AshTestHelperTest, AshTestHelper) {
45 // Check initial state. 48 // Check initial state.
46 EXPECT_TRUE(ash_test_helper()->message_loop());
47 EXPECT_TRUE(ash_test_helper()->test_shell_delegate()); 49 EXPECT_TRUE(ash_test_helper()->test_shell_delegate());
48 EXPECT_TRUE(ash_test_helper()->CurrentContext()); 50 EXPECT_TRUE(ash_test_helper()->CurrentContext());
49 51
50 // Enough state is initialized to create a window. 52 // Enough state is initialized to create a window.
51 using views::Widget; 53 using views::Widget;
52 std::unique_ptr<Widget> w1(new Widget); 54 std::unique_ptr<Widget> w1(new Widget);
53 Widget::InitParams params; 55 Widget::InitParams params;
54 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 56 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
55 params.context = ash_test_helper()->CurrentContext(); 57 params.context = ash_test_helper()->CurrentContext();
56 w1->Init(params); 58 w1->Init(params);
57 w1->Show(); 59 w1->Show();
58 EXPECT_TRUE(w1->IsActive()); 60 EXPECT_TRUE(w1->IsActive());
59 EXPECT_TRUE(w1->IsVisible()); 61 EXPECT_TRUE(w1->IsVisible());
60 } 62 }
63
64 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/ash_test_helper.cc ('k') | ash/test/ash_test_views_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698