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

Side by Side Diff: base/memory/scoped_ptr_unittest.cc

Issue 1586833002: Convert Pass()→std::move() for iOS build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | chrome/browser/policy/profile_policy_connector_stub.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <sstream> 9 #include <sstream>
10 #include <utility>
10 11
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "build/build_config.h" 15 #include "build/build_config.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 17
17 namespace { 18 namespace {
18 19
19 // Used to test depth subtyping. 20 // Used to test depth subtyping.
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 #if !defined(OS_ANDROID) && !defined(OS_LINUX) 406 #if !defined(OS_ANDROID) && !defined(OS_LINUX)
406 // Test uncaught Pass() does not have side effects, because Pass() 407 // Test uncaught Pass() does not have side effects, because Pass()
407 // is implemented by std::move(). 408 // is implemented by std::move().
408 // TODO(danakj): Remove this test case when we remove Pass(). 409 // TODO(danakj): Remove this test case when we remove Pass().
409 { 410 {
410 ConDecLogger* logger = new ConDecLogger(&constructed); 411 ConDecLogger* logger = new ConDecLogger(&constructed);
411 scoped_ptr<ConDecLogger> scoper(logger); 412 scoped_ptr<ConDecLogger> scoper(logger);
412 EXPECT_EQ(1, constructed); 413 EXPECT_EQ(1, constructed);
413 414
414 // Should auto-destruct logger by end of scope. 415 // Should auto-destruct logger by end of scope.
415 scoped_ptr<ConDecLogger>&& rvalue = scoper.Pass(); 416 scoped_ptr<ConDecLogger>&& rvalue = std::move(scoper);
dcheng 2016/01/14 00:37:51 Oops, this got included by accident. I've reverted
416 // The Pass() function mimics std::move(), which does not have side-effects. 417 // The Pass() function mimics std::move(), which does not have side-effects.
417 EXPECT_TRUE(scoper.get()); 418 EXPECT_TRUE(scoper.get());
418 EXPECT_TRUE(rvalue); 419 EXPECT_TRUE(rvalue);
419 } 420 }
420 EXPECT_EQ(0, constructed); 421 EXPECT_EQ(0, constructed);
421 #endif 422 #endif
422 423
423 // Test that passing to function which does nothing does not leak. 424 // Test that passing to function which does nothing does not leak.
424 { 425 {
425 ConDecLogger* logger = new ConDecLogger(&constructed); 426 ConDecLogger* logger = new ConDecLogger(&constructed);
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 EXPECT_FALSE(p < nullptr); 834 EXPECT_FALSE(p < nullptr);
834 EXPECT_TRUE(nullptr < p); 835 EXPECT_TRUE(nullptr < p);
835 EXPECT_FALSE(pnull < nullptr); 836 EXPECT_FALSE(pnull < nullptr);
836 EXPECT_FALSE(nullptr < pnull); 837 EXPECT_FALSE(nullptr < pnull);
837 838
838 EXPECT_FALSE(p <= nullptr); 839 EXPECT_FALSE(p <= nullptr);
839 EXPECT_TRUE(nullptr <= p); 840 EXPECT_TRUE(nullptr <= p);
840 EXPECT_TRUE(pnull <= nullptr); 841 EXPECT_TRUE(pnull <= nullptr);
841 EXPECT_TRUE(nullptr <= pnull); 842 EXPECT_TRUE(nullptr <= pnull);
842 } 843 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/policy/profile_policy_connector_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698