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

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

Issue 1350183002: EDK: More scoped_ptr -> std::unique_ptr conversions. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: gah Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/embedder/simple_platform_shared_buffer_posix.cc ('k') | mojo/edk/system/core.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cc66c7648978b7f46ac5961c8f5f987d38eccfc2..368604fafb83e51f3a3c8939747436393822776e 100644
--- a/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
+++ b/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
@@ -7,7 +7,6 @@
#include <limits>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "mojo/public/cpp/system/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -29,7 +28,8 @@ TEST(SimplePlatformSharedBufferTest, Basic) {
// Map it all, scribble some stuff, and then unmap it.
{
EXPECT_TRUE(buffer->IsValidMap(0, kNumBytes));
- scoped_ptr<PlatformSharedBufferMapping> mapping(buffer->Map(0, kNumBytes));
+ std::unique_ptr<PlatformSharedBufferMapping> mapping(
+ buffer->Map(0, kNumBytes));
ASSERT_TRUE(mapping);
ASSERT_TRUE(mapping->GetBase());
int* stuff = static_cast<int*>(mapping->GetBase());
@@ -44,7 +44,7 @@ TEST(SimplePlatformSharedBufferTest, Basic) {
{
ASSERT_TRUE(buffer->IsValidMap(0, kNumBytes));
// Use |MapNoCheck()| this time.
- scoped_ptr<PlatformSharedBufferMapping> mapping1(
+ std::unique_ptr<PlatformSharedBufferMapping> mapping1(
buffer->MapNoCheck(0, kNumBytes));
ASSERT_TRUE(mapping1);
ASSERT_TRUE(mapping1->GetBase());
@@ -52,7 +52,7 @@ TEST(SimplePlatformSharedBufferTest, Basic) {
for (size_t i = 0; i < kNumInts; i++)
EXPECT_EQ(static_cast<int>(i) + kFudge, stuff1[i]) << i;
- scoped_ptr<PlatformSharedBufferMapping> mapping2(
+ std::unique_ptr<PlatformSharedBufferMapping> mapping2(
buffer->Map((kNumInts / 2) * sizeof(int), 2 * sizeof(int)));
ASSERT_TRUE(mapping2);
ASSERT_TRUE(mapping2->GetBase());
@@ -76,7 +76,7 @@ TEST(SimplePlatformSharedBufferTest, Basic) {
// it to be.
{
EXPECT_TRUE(buffer->IsValidMap(sizeof(int), kNumBytes - sizeof(int)));
- scoped_ptr<PlatformSharedBufferMapping> mapping(
+ std::unique_ptr<PlatformSharedBufferMapping> mapping(
buffer->Map(sizeof(int), kNumBytes - sizeof(int)));
ASSERT_TRUE(mapping);
ASSERT_TRUE(mapping->GetBase());
@@ -144,8 +144,8 @@ TEST(SimplePlatformSharedBufferTest, TooBig) {
TEST(SimplePlatformSharedBufferTest, MappingsDistinct) {
scoped_refptr<SimplePlatformSharedBuffer> buffer(
SimplePlatformSharedBuffer::Create(100));
- scoped_ptr<PlatformSharedBufferMapping> mapping1(buffer->Map(0, 100));
- scoped_ptr<PlatformSharedBufferMapping> mapping2(buffer->Map(0, 100));
+ std::unique_ptr<PlatformSharedBufferMapping> mapping1(buffer->Map(0, 100));
+ std::unique_ptr<PlatformSharedBufferMapping> mapping2(buffer->Map(0, 100));
EXPECT_NE(mapping1->GetBase(), mapping2->GetBase());
}
@@ -154,7 +154,8 @@ TEST(SimplePlatformSharedBufferTest, BufferZeroInitialized) {
for (size_t i = 0; i < MOJO_ARRAYSIZE(kSizes); i++) {
scoped_refptr<SimplePlatformSharedBuffer> buffer(
SimplePlatformSharedBuffer::Create(kSizes[i]));
- scoped_ptr<PlatformSharedBufferMapping> mapping(buffer->Map(0, kSizes[i]));
+ std::unique_ptr<PlatformSharedBufferMapping> mapping(
+ buffer->Map(0, kSizes[i]));
for (size_t j = 0; j < kSizes[i]; j++) {
// "Assert" instead of "expect" so we don't spam the output with thousands
// of failures if we fail.
@@ -165,14 +166,14 @@ TEST(SimplePlatformSharedBufferTest, BufferZeroInitialized) {
}
TEST(SimplePlatformSharedBufferTest, MappingsOutliveBuffer) {
- scoped_ptr<PlatformSharedBufferMapping> mapping1;
- scoped_ptr<PlatformSharedBufferMapping> mapping2;
+ std::unique_ptr<PlatformSharedBufferMapping> mapping1;
+ std::unique_ptr<PlatformSharedBufferMapping> mapping2;
{
scoped_refptr<SimplePlatformSharedBuffer> buffer(
SimplePlatformSharedBuffer::Create(100));
- mapping1 = buffer->Map(0, 100).Pass();
- mapping2 = buffer->Map(50, 50).Pass();
+ mapping1 = buffer->Map(0, 100);
+ mapping2 = buffer->Map(50, 50);
static_cast<char*>(mapping1->GetBase())[50] = 'x';
}
« no previous file with comments | « mojo/edk/embedder/simple_platform_shared_buffer_posix.cc ('k') | mojo/edk/system/core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698