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_ANDROID) && !defined(OS_LINUX) && !defined(OS_MACOSX) | 405 #if !defined(OS_ANDROID) && !defined(OS_LINUX) && !defined(OS_MACOSX) && \ |
| 406 !defined(OS_WIN) |
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 = scoper.Pass(); |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 | 863 |
863 if (null_ptr) { | 864 if (null_ptr) { |
864 ADD_FAILURE() << "Null pointer should result in false."; | 865 ADD_FAILURE() << "Null pointer should result in false."; |
865 } | 866 } |
866 | 867 |
867 if (!null_ptr) { // check for operator!(). | 868 if (!null_ptr) { // check for operator!(). |
868 } else { | 869 } else { |
869 ADD_FAILURE() << "Null pointer should result in !x being true."; | 870 ADD_FAILURE() << "Null pointer should result in !x being true."; |
870 } | 871 } |
871 } | 872 } |
OLD | NEW |