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

Side by Side Diff: chrome_frame/test/exception_barrier_unittest.cc

Issue 2222002: Unsigned warning fix - take 2 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome_frame/test/chrome_frame_test_utils.cc ('k') | chrome_frame/test/html_util_unittests.cc » ('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 (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 11 matching lines...) Expand all
22 // # Is the registration DWORD aligned 22 // # Is the registration DWORD aligned
23 // # Does each exception handler point to a module, as opposed to 23 // # Does each exception handler point to a module, as opposed to
24 // e.g. into the stack or never-never land. 24 // e.g. into the stack or never-never land.
25 // # Do successive entries in the exception chain increase 25 // # Do successive entries in the exception chain increase
26 // monotonically in address 26 // monotonically in address
27 void TestSEHChainSane() { 27 void TestSEHChainSane() {
28 // get the skinny on our stack segment 28 // get the skinny on our stack segment
29 MEMORY_BASIC_INFORMATION info = { 0 }; 29 MEMORY_BASIC_INFORMATION info = { 0 };
30 // Note that we pass the address of the info struct just as a handy 30 // Note that we pass the address of the info struct just as a handy
31 // moniker to anything at all inside our stack allocation 31 // moniker to anything at all inside our stack allocation
32 ASSERT_NE(0, ::VirtualQuery(&info, &info, sizeof(info))); 32 ASSERT_NE(0u, ::VirtualQuery(&info, &info, sizeof(info)));
33 33
34 // The lower bound of our stack. 34 // The lower bound of our stack.
35 // We use the address of info as a lower bound, this assumes that if this 35 // We use the address of info as a lower bound, this assumes that if this
36 // function has an SEH handler, it'll be higher up in our invocation 36 // function has an SEH handler, it'll be higher up in our invocation
37 // record. 37 // record.
38 EXCEPTION_REGISTRATION* limit = 38 EXCEPTION_REGISTRATION* limit =
39 reinterpret_cast<EXCEPTION_REGISTRATION*>(&info); 39 reinterpret_cast<EXCEPTION_REGISTRATION*>(&info);
40 // the very top of our stack segment 40 // the very top of our stack segment
41 EXCEPTION_REGISTRATION* top = 41 EXCEPTION_REGISTRATION* top =
42 reinterpret_cast<EXCEPTION_REGISTRATION*>( 42 reinterpret_cast<EXCEPTION_REGISTRATION*>(
(...skipping 10 matching lines...) Expand all
53 // registrations must increase monotonically 53 // registrations must increase monotonically
54 ASSERT_TRUE(curr > prev); 54 ASSERT_TRUE(curr > prev);
55 // Check it's in bounds 55 // Check it's in bounds
56 ASSERT_GE(top, curr); 56 ASSERT_GE(top, curr);
57 ASSERT_LT(limit, curr); 57 ASSERT_LT(limit, curr);
58 58
59 // check for DWORD alignment 59 // check for DWORD alignment
60 ASSERT_EQ(0, (reinterpret_cast<UINT_PTR>(prev) & 0x00000003)); 60 ASSERT_EQ(0, (reinterpret_cast<UINT_PTR>(prev) & 0x00000003));
61 61
62 // find the module hosting the handler 62 // find the module hosting the handler
63 ASSERT_NE(0, ::VirtualQuery(curr->handler, &info, sizeof(info))); 63 ASSERT_NE(0u, ::VirtualQuery(curr->handler, &info, sizeof(info)));
64 wchar_t module_filename[MAX_PATH]; 64 wchar_t module_filename[MAX_PATH];
65 ASSERT_NE(0, ::GetModuleFileName( 65 ASSERT_NE(0u, ::GetModuleFileName(
66 reinterpret_cast<HMODULE>(info.AllocationBase), 66 reinterpret_cast<HMODULE>(info.AllocationBase),
67 module_filename, ARRAYSIZE(module_filename))); 67 module_filename, ARRAYSIZE(module_filename)));
68 } 68 }
69 } 69 }
70 70
71 void AccessViolationCrash() { 71 void AccessViolationCrash() {
72 volatile char* null = NULL; 72 volatile char* null = NULL;
73 *null = '\0'; 73 *null = '\0';
74 } 74 }
75 75
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « chrome_frame/test/chrome_frame_test_utils.cc ('k') | chrome_frame/test/html_util_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698