OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 DISALLOW_COPY_AND_ASSIGN(ScopedProcessSuspendTest); | 88 DISALLOW_COPY_AND_ASSIGN(ScopedProcessSuspendTest); |
89 }; | 89 }; |
90 | 90 |
91 TEST(ScopedProcessSuspend, ScopedProcessSuspend) { | 91 TEST(ScopedProcessSuspend, ScopedProcessSuspend) { |
92 WinChildProcess::EntryPoint<ScopedProcessSuspendTest>(); | 92 WinChildProcess::EntryPoint<ScopedProcessSuspendTest>(); |
93 scoped_ptr<WinChildProcess::Handles> handles = WinChildProcess::Launch(); | 93 scoped_ptr<WinChildProcess::Handles> handles = WinChildProcess::Launch(); |
94 | 94 |
95 EXPECT_TRUE(SuspendCountMatches(handles->process.get(), 0)); | 95 EXPECT_TRUE(SuspendCountMatches(handles->process.get(), 0)); |
96 | 96 |
97 { | 97 { |
98 ScopedProcessSuspend suspend(handles->process.get()); | 98 ScopedProcessSuspend suspend0(handles->process.get()); |
99 EXPECT_TRUE(SuspendCountMatches(handles->process.get(), 1)); | 99 EXPECT_TRUE(SuspendCountMatches(handles->process.get(), 1)); |
100 | 100 |
101 { | 101 { |
102 ScopedProcessSuspend suspend(handles->process.get()); | 102 ScopedProcessSuspend suspend1(handles->process.get()); |
103 EXPECT_TRUE(SuspendCountMatches(handles->process.get(), 2)); | 103 EXPECT_TRUE(SuspendCountMatches(handles->process.get(), 2)); |
104 } | 104 } |
105 | 105 |
106 EXPECT_TRUE(SuspendCountMatches(handles->process.get(), 1)); | 106 EXPECT_TRUE(SuspendCountMatches(handles->process.get(), 1)); |
107 } | 107 } |
108 | 108 |
109 EXPECT_TRUE(SuspendCountMatches(handles->process.get(), 0)); | 109 EXPECT_TRUE(SuspendCountMatches(handles->process.get(), 0)); |
110 | 110 |
111 // Tell the child it's OK to terminate. | 111 // Tell the child it's OK to terminate. |
112 char c = ' '; | 112 char c = ' '; |
113 EXPECT_TRUE(WriteFile(handles->write.get(), &c, sizeof(c))); | 113 EXPECT_TRUE(WriteFile(handles->write.get(), &c, sizeof(c))); |
114 } | 114 } |
115 | 115 |
116 } // namespace | 116 } // namespace |
117 } // namespace test | 117 } // namespace test |
118 } // namespace crashpad | 118 } // namespace crashpad |
OLD | NEW |