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

Unified Diff: mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc

Issue 1441853003: Make the new Mojo EDK work on XP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fixes Created 5 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 side-by-side diff with in-line comments
Download patch
Index: mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
diff --git a/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc b/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
index a0e915e63610902767c3c8106f40ab9445b924c0..27c3bf5b02ad6573a43068efcad69d5a0bf8743d 100644
--- a/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
+++ b/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
@@ -8,9 +8,14 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/sys_info.h"
#include "mojo/public/cpp/system/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
+#if defined(OS_WIN)
+#include "base/win/windows_version.h"
+#endif
+
namespace mojo {
namespace edk {
namespace {
@@ -128,13 +133,15 @@ TEST(SimplePlatformSharedBufferTest, InvalidMappings) {
TEST(SimplePlatformSharedBufferTest, TooBig) {
// If |size_t| is 32-bit, it's quite possible/likely that |Create()| succeeds
// (since it only involves creating a 4 GB file).
- const size_t kMaxSizeT = std::numeric_limits<size_t>::max();
+ size_t max_size = std::numeric_limits<size_t>::max();
+ if (max_size > static_cast<size_t>(base::SysInfo::AmountOfVirtualMemory()))
+ max_size = static_cast<size_t>(base::SysInfo::AmountOfVirtualMemory());
scoped_refptr<SimplePlatformSharedBuffer> buffer(
- SimplePlatformSharedBuffer::Create(kMaxSizeT));
+ SimplePlatformSharedBuffer::Create(max_size));
// But, assuming |sizeof(size_t) == sizeof(void*)|, mapping all of it should
// always fail.
if (buffer)
- EXPECT_FALSE(buffer->Map(0, kMaxSizeT));
+ EXPECT_FALSE(buffer->Map(0, max_size));
}
// Tests that separate mappings get distinct addresses.

Powered by Google App Engine
This is Rietveld 408576698