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

Side by Side Diff: mojo/system/local_data_pipe_unittest.cc

Issue 603983003: Mojo: COMPILE_ASSERT -> static_assert in mojo/system and mojo/embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « mojo/system/handle_table.cc ('k') | mojo/system/memory_unittest.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "mojo/system/local_data_pipe.h" 5 #include "mojo/system/local_data_pipe.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 // Try writing way too much (two-phase). 1367 // Try writing way too much (two-phase).
1368 uint32_t num_bytes = 20u * sizeof(int32_t); 1368 uint32_t num_bytes = 20u * sizeof(int32_t);
1369 void* write_ptr = nullptr; 1369 void* write_ptr = nullptr;
1370 EXPECT_EQ( 1370 EXPECT_EQ(
1371 MOJO_RESULT_OUT_OF_RANGE, 1371 MOJO_RESULT_OUT_OF_RANGE,
1372 dp->ProducerBeginWriteData( 1372 dp->ProducerBeginWriteData(
1373 MakeUserPointer(&write_ptr), MakeUserPointer(&num_bytes), true)); 1373 MakeUserPointer(&write_ptr), MakeUserPointer(&num_bytes), true));
1374 1374
1375 // Try writing an amount which isn't a multiple of the element size 1375 // Try writing an amount which isn't a multiple of the element size
1376 // (two-phase). 1376 // (two-phase).
1377 COMPILE_ASSERT(sizeof(int32_t) > 1u, wow_int32_ts_have_size_1); 1377 static_assert(sizeof(int32_t) > 1u, "Wow! int32_t's have size 1");
1378 num_bytes = 1u; 1378 num_bytes = 1u;
1379 write_ptr = nullptr; 1379 write_ptr = nullptr;
1380 EXPECT_EQ( 1380 EXPECT_EQ(
1381 MOJO_RESULT_INVALID_ARGUMENT, 1381 MOJO_RESULT_INVALID_ARGUMENT,
1382 dp->ProducerBeginWriteData( 1382 dp->ProducerBeginWriteData(
1383 MakeUserPointer(&write_ptr), MakeUserPointer(&num_bytes), true)); 1383 MakeUserPointer(&write_ptr), MakeUserPointer(&num_bytes), true));
1384 1384
1385 // Try reading way too much (two-phase). 1385 // Try reading way too much (two-phase).
1386 num_bytes = 20u * sizeof(int32_t); 1386 num_bytes = 20u * sizeof(int32_t);
1387 const void* read_ptr = nullptr; 1387 const void* read_ptr = nullptr;
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 // End reading. 1994 // End reading.
1995 EXPECT_EQ(MOJO_RESULT_OK, dp->ConsumerEndReadData(2u)); 1995 EXPECT_EQ(MOJO_RESULT_OK, dp->ConsumerEndReadData(2u));
1996 1996
1997 dp->ProducerClose(); 1997 dp->ProducerClose();
1998 dp->ConsumerClose(); 1998 dp->ConsumerClose();
1999 } 1999 }
2000 2000
2001 } // namespace 2001 } // namespace
2002 } // namespace system 2002 } // namespace system
2003 } // namespace mojo 2003 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/handle_table.cc ('k') | mojo/system/memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698