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

Side by Side Diff: core/fxcrt/cfx_retain_ptr_unittest.cpp

Issue 2324733003: explicit operator bool for CFX_RetainPtr and CFX_CountRef (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | core/fxcrt/include/cfx_count_ref.h » ('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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium 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 "core/fxcrt/include/cfx_retain_ptr.h" 5 #include "core/fxcrt/include/cfx_retain_ptr.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "testing/fx_string_testhelpers.h" 9 #include "testing/fx_string_testhelpers.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 EXPECT_TRUE(null_ptr1 != obj1_ptr1); 202 EXPECT_TRUE(null_ptr1 != obj1_ptr1);
203 EXPECT_TRUE(null_ptr1 != obj2_ptr1); 203 EXPECT_TRUE(null_ptr1 != obj2_ptr1);
204 EXPECT_TRUE(obj1_ptr1 != obj2_ptr1); 204 EXPECT_TRUE(obj1_ptr1 != obj2_ptr1);
205 } 205 }
206 206
207 TEST(fxcrt, RetainPtrBool) { 207 TEST(fxcrt, RetainPtrBool) {
208 PseudoRetainable obj1; 208 PseudoRetainable obj1;
209 CFX_RetainPtr<PseudoRetainable> null_ptr; 209 CFX_RetainPtr<PseudoRetainable> null_ptr;
210 CFX_RetainPtr<PseudoRetainable> obj1_ptr(&obj1); 210 CFX_RetainPtr<PseudoRetainable> obj1_ptr(&obj1);
211 bool null_bool = null_ptr; 211 bool null_bool = !!null_ptr;
212 bool obj1_bool = obj1_ptr; 212 bool obj1_bool = !!obj1_ptr;
213 EXPECT_FALSE(null_bool); 213 EXPECT_FALSE(null_bool);
214 EXPECT_TRUE(obj1_bool); 214 EXPECT_TRUE(obj1_bool);
215 } 215 }
OLDNEW
« no previous file with comments | « no previous file | core/fxcrt/include/cfx_count_ref.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698