OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/env/public/athena_env.h" | 5 #include "athena/env/public/athena_env.h" |
6 | 6 |
7 #include "athena/test/athena_test_base.h" | 7 #include "athena/test/athena_test_base.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "ui/gfx/display.h" | 9 #include "ui/gfx/display.h" |
10 #include "ui/gfx/screen.h" | 10 #include "ui/gfx/screen.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 callback_2.Reset(); | 92 callback_2.Reset(); |
93 env->AddTerminatingCallback(cb_1_2); | 93 env->AddTerminatingCallback(cb_1_2); |
94 env->OnTerminating(); | 94 env->OnTerminating(); |
95 EXPECT_EQ(0, callback_1.on_terminating_count()); | 95 EXPECT_EQ(0, callback_1.on_terminating_count()); |
96 EXPECT_EQ(1, callback_1.on_terminating_2_count()); | 96 EXPECT_EQ(1, callback_1.on_terminating_2_count()); |
97 EXPECT_EQ(1, callback_2.on_terminating_count()); | 97 EXPECT_EQ(1, callback_2.on_terminating_count()); |
98 | 98 |
99 // Adding empty callback should not fail. | 99 // Adding empty callback should not fail. |
100 env->AddTerminatingCallback(base::Closure()); | 100 env->AddTerminatingCallback(base::Closure()); |
101 env->OnTerminating(); | 101 env->OnTerminating(); |
| 102 env->RemoveTerminatingCallback(cb_1_2); |
| 103 env->RemoveTerminatingCallback(cb_2_1); |
102 } | 104 } |
103 | 105 |
104 namespace { | 106 namespace { |
105 | 107 |
106 class AthenaShutdownTest : public test::AthenaTestBase { | 108 class AthenaShutdownTest : public test::AthenaTestBase { |
107 public: | 109 public: |
108 AthenaShutdownTest() {} | 110 AthenaShutdownTest() {} |
109 virtual ~AthenaShutdownTest() {} | 111 virtual ~AthenaShutdownTest() {} |
110 | 112 |
111 virtual void TearDown() { | 113 virtual void TearDown() { |
112 test::AthenaTestBase::TearDown(); | 114 test::AthenaTestBase::TearDown(); |
113 ASSERT_NE( | 115 ASSERT_NE( |
114 gfx::Display::kInvalidDisplayID, | 116 gfx::Display::kInvalidDisplayID, |
115 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id()); | 117 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().id()); |
116 } | 118 } |
117 | 119 |
118 private: | 120 private: |
119 DISALLOW_COPY_AND_ASSIGN(AthenaShutdownTest); | 121 DISALLOW_COPY_AND_ASSIGN(AthenaShutdownTest); |
120 }; | 122 }; |
121 | 123 |
122 } // namespace | 124 } // namespace |
123 | 125 |
124 // gfx::Screen should be accessible after shutdown. | 126 // gfx::Screen should be accessible after shutdown. |
125 TEST_F(AthenaShutdownTest, Shutdown) { | 127 TEST_F(AthenaShutdownTest, Shutdown) { |
126 } | 128 } |
127 | 129 |
128 } // namespace athena | 130 } // namespace athena |
OLD | NEW |