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

Unified Diff: mojo/public/cpp/system/tests/core_unittest.cc

Issue 1535943002: Convert Pass()→std::move() in //mojo/public/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove self-move checks to avoid triggering clang warning. Created 5 years 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/public/cpp/system/tests/core_unittest.cc
diff --git a/mojo/public/cpp/system/tests/core_unittest.cc b/mojo/public/cpp/system/tests/core_unittest.cc
index 4dcad4332bd7e91fb1a249f4f06b7b4dfd0796bd..a8092e4171a4d2932b11ca6b7aef6fffaee67a8c 100644
--- a/mojo/public/cpp/system/tests/core_unittest.cc
+++ b/mojo/public/cpp/system/tests/core_unittest.cc
@@ -6,12 +6,11 @@
// TODO(vtl): Maybe rename "CoreCppTest" -> "CoreTest" if/when this gets
// compiled into a different binary from the C API tests.
-#include "mojo/public/cpp/system/core.h"
-
#include <stddef.h>
-
#include <map>
+#include <utility>
+#include "mojo/public/cpp/system/core.h"
#include "mojo/public/cpp/system/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -102,7 +101,7 @@ TEST(CoreCppTest, Basic) {
EXPECT_EQ(kInvalidHandleValue, h.get().value());
// This should be a no-op.
- Close(h.Pass());
+ Close(std::move(h));
// It should still be invalid.
EXPECT_EQ(kInvalidHandleValue, h.get().value());
@@ -212,7 +211,7 @@ TEST(CoreCppTest, Basic) {
EXPECT_EQ(kSignalAll, states[1].satisfiable_signals);
// Test closing |h1| explicitly.
- Close(h1.Pass());
+ Close(std::move(h1));
EXPECT_FALSE(h1.get().is_valid());
// Make sure |h1| is closed.
@@ -473,22 +472,12 @@ TEST(CoreCppTest, ScopedHandleMoveCtor) {
// If this fails to close buffer1, ScopedHandleBase::CloseIfNecessary() will
// assert.
- buffer1 = buffer2.Pass();
+ buffer1 = std::move(buffer2);
EXPECT_TRUE(buffer1.is_valid());
EXPECT_FALSE(buffer2.is_valid());
}
-TEST(CoreCppTest, ScopedHandleMoveCtorSelf) {
- ScopedSharedBufferHandle buffer1;
- EXPECT_EQ(MOJO_RESULT_OK, CreateSharedBuffer(nullptr, 1024, &buffer1));
- EXPECT_TRUE(buffer1.is_valid());
-
- buffer1 = buffer1.Pass();
dcheng 2015/12/18 09:54:41 Clang has a -Wself-move warning that this triggers
-
- EXPECT_TRUE(buffer1.is_valid());
-}
-
// TODO(vtl): Write data pipe tests.
} // namespace

Powered by Google App Engine
This is Rietveld 408576698