| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "gtest/gtest.h" | 5 #include "gtest/gtest.h" |
| 6 #include "chrome_frame/exception_barrier.h" | 6 #include "chrome_frame/exception_barrier.h" |
| 7 | 7 |
| 8 namespace { | 8 namespace { |
| 9 | 9 |
| 10 // retrieves the top SEH registration record | 10 // retrieves the top SEH registration record |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 TEST_F(ExceptionBarrierTest, RegisterUnregister) { | 161 TEST_F(ExceptionBarrierTest, RegisterUnregister) { |
| 162 // Assert that registration modifies the chain | 162 // Assert that registration modifies the chain |
| 163 // and the registered record as expected | 163 // and the registered record as expected |
| 164 EXCEPTION_REGISTRATION* top = GetTopRegistration(); | 164 EXCEPTION_REGISTRATION* top = GetTopRegistration(); |
| 165 ExceptionBarrierHandlerFunc handler = top->handler; | 165 ExceptionBarrierHandlerFunc handler = top->handler; |
| 166 EXCEPTION_REGISTRATION* prev = top->prev; | 166 EXCEPTION_REGISTRATION* prev = top->prev; |
| 167 | 167 |
| 168 EXCEPTION_REGISTRATION registration; | 168 EXCEPTION_REGISTRATION registration; |
| 169 ::RegisterExceptionRecord(®istration, ExceptionBarrierHandler); | 169 ::RegisterExceptionRecord(®istration, ExceptionBarrierHandler); |
| 170 EXPECT_EQ(GetTopRegistration(), ®istration); | 170 EXPECT_EQ(GetTopRegistration(), ®istration); |
| 171 EXPECT_EQ(ExceptionBarrierHandler, registration.handler); | 171 EXPECT_EQ(&ExceptionBarrierHandler, registration.handler); |
| 172 EXPECT_EQ(top, registration.prev); | 172 EXPECT_EQ(top, registration.prev); |
| 173 | 173 |
| 174 // test the whole chain for good measure | 174 // test the whole chain for good measure |
| 175 TestSEHChainSane(); | 175 TestSEHChainSane(); |
| 176 | 176 |
| 177 // Assert that unregistration restores | 177 // Assert that unregistration restores |
| 178 // everything as expected | 178 // everything as expected |
| 179 ::UnregisterExceptionRecord(®istration); | 179 ::UnregisterExceptionRecord(®istration); |
| 180 EXPECT_EQ(top, GetTopRegistration()); | 180 EXPECT_EQ(top, GetTopRegistration()); |
| 181 EXPECT_EQ(handler, top->handler); | 181 EXPECT_EQ(handler, top->handler); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 return TestRegularChaining(top) && TestExceptionBarrierChaining(top); | 349 return TestRegularChaining(top) && TestExceptionBarrierChaining(top); |
| 350 } | 350 } |
| 351 | 351 |
| 352 // Test that the SEH chain is unmolested by exception barrier, both under | 352 // Test that the SEH chain is unmolested by exception barrier, both under |
| 353 // regular unroll, and under exception unroll. | 353 // regular unroll, and under exception unroll. |
| 354 TEST_F(ExceptionBarrierTest, SEHChainIsSaneAfterException) { | 354 TEST_F(ExceptionBarrierTest, SEHChainIsSaneAfterException) { |
| 355 EXPECT_TRUE(TestChaining()); | 355 EXPECT_TRUE(TestChaining()); |
| 356 } | 356 } |
| 357 | 357 |
| 358 } // namespace | 358 } // namespace |
| OLD | NEW |