OLD | NEW |
---|---|
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 | 10 |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
395 | 395 |
396 // Test moving with assignment; | 396 // Test moving with assignment; |
397 scoped_ptr<ConDecLogger> scoper3; | 397 scoped_ptr<ConDecLogger> scoper3; |
398 scoper3 = std::move(scoper2); | 398 scoper3 = std::move(scoper2); |
399 EXPECT_EQ(1, constructed); | 399 EXPECT_EQ(1, constructed); |
400 EXPECT_FALSE(scoper.get()); | 400 EXPECT_FALSE(scoper.get()); |
401 EXPECT_FALSE(scoper2.get()); | 401 EXPECT_FALSE(scoper2.get()); |
402 EXPECT_TRUE(scoper3.get()); | 402 EXPECT_TRUE(scoper3.get()); |
403 } | 403 } |
404 | 404 |
405 #if !(defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 405 #if !(defined(OS_ANDROID) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))) |
dcheng
2015/12/30 22:10:47
I'll simplify this conditional once I get CrOS con
| |
406 // Test uncaught Pass() does not have side effects, because Pass() | 406 // Test uncaught Pass() does not have side effects, because Pass() |
407 // is implemented by std::move(). | 407 // is implemented by std::move(). |
408 // TODO(danakj): Remove this test case when we remove Pass(). | 408 // TODO(danakj): Remove this test case when we remove Pass(). |
409 { | 409 { |
410 ConDecLogger* logger = new ConDecLogger(&constructed); | 410 ConDecLogger* logger = new ConDecLogger(&constructed); |
411 scoped_ptr<ConDecLogger> scoper(logger); | 411 scoped_ptr<ConDecLogger> scoper(logger); |
412 EXPECT_EQ(1, constructed); | 412 EXPECT_EQ(1, constructed); |
413 | 413 |
414 // Should auto-destruct logger by end of scope. | 414 // Should auto-destruct logger by end of scope. |
415 scoped_ptr<ConDecLogger>&& rvalue = scoper.Pass(); | 415 scoped_ptr<ConDecLogger>&& rvalue = scoper.Pass(); |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
833 EXPECT_FALSE(p < nullptr); | 833 EXPECT_FALSE(p < nullptr); |
834 EXPECT_TRUE(nullptr < p); | 834 EXPECT_TRUE(nullptr < p); |
835 EXPECT_FALSE(pnull < nullptr); | 835 EXPECT_FALSE(pnull < nullptr); |
836 EXPECT_FALSE(nullptr < pnull); | 836 EXPECT_FALSE(nullptr < pnull); |
837 | 837 |
838 EXPECT_FALSE(p <= nullptr); | 838 EXPECT_FALSE(p <= nullptr); |
839 EXPECT_TRUE(nullptr <= p); | 839 EXPECT_TRUE(nullptr <= p); |
840 EXPECT_TRUE(pnull <= nullptr); | 840 EXPECT_TRUE(pnull <= nullptr); |
841 EXPECT_TRUE(nullptr <= pnull); | 841 EXPECT_TRUE(nullptr <= pnull); |
842 } | 842 } |
OLD | NEW |