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

Side by Side Diff: terminator_unittest.cc

Issue 5206007: AU: Make sure that subsequent non-Terminator unit tests don't exit. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
Patch Set: Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 <gtest/gtest.h> 5 #include <gtest/gtest.h>
6 #include <gtest/gtest-spi.h> 6 #include <gtest/gtest-spi.h>
7 7
8 #include "update_engine/terminator.h" 8 #include "update_engine/terminator.h"
9 9
10 using std::string; 10 using std::string;
11 using testing::ExitedWithCode; 11 using testing::ExitedWithCode;
12 12
13 namespace chromeos_update_engine { 13 namespace chromeos_update_engine {
14 14
15 class TerminatorTest : public ::testing::Test { 15 class TerminatorTest : public ::testing::Test {
16 protected: 16 protected:
17 virtual void SetUp() { 17 virtual void SetUp() {
18 Terminator::Init(); 18 Terminator::Init();
19 ASSERT_FALSE(Terminator::exit_blocked()); 19 ASSERT_FALSE(Terminator::exit_blocked());
20 ASSERT_FALSE(Terminator::exit_requested()); 20 ASSERT_FALSE(Terminator::exit_requested());
21 } 21 }
22 virtual void TearDown() {
23 // Makes sure subsequent non-Terminator tests don't get accidentally
24 // terminated.
25 Terminator::Init();
26 }
22 }; 27 };
23 28
24 typedef TerminatorTest TerminatorDeathTest; 29 typedef TerminatorTest TerminatorDeathTest;
25 30
26 namespace { 31 namespace {
27 void UnblockExitThroughUnblocker() { 32 void UnblockExitThroughUnblocker() {
28 ScopedTerminatorExitUnblocker unblocker = ScopedTerminatorExitUnblocker(); 33 ScopedTerminatorExitUnblocker unblocker = ScopedTerminatorExitUnblocker();
29 } 34 }
30 35
31 void RaiseSIGTERM() { 36 void RaiseSIGTERM() {
(...skipping 28 matching lines...) Expand all
60 EXPECT_FATAL_FAILURE(RaiseSIGTERM(), ""); 65 EXPECT_FATAL_FAILURE(RaiseSIGTERM(), "");
61 } 66 }
62 67
63 TEST_F(TerminatorDeathTest, ScopedTerminatorExitUnblockerExitTest) { 68 TEST_F(TerminatorDeathTest, ScopedTerminatorExitUnblockerExitTest) {
64 Terminator::set_exit_blocked(true); 69 Terminator::set_exit_blocked(true);
65 Terminator::exit_requested_ = 1; 70 Terminator::exit_requested_ = 1;
66 ASSERT_EXIT(UnblockExitThroughUnblocker(), ExitedWithCode(0), ""); 71 ASSERT_EXIT(UnblockExitThroughUnblocker(), ExitedWithCode(0), "");
67 } 72 }
68 73
69 } // namespace chromeos_update_engine 74 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698