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

Side by Side Diff: chrome/common/property_bag_unittest.cc

Issue 179028: Revert "Fix a ton of compiler warnings." (Closed)
Patch Set: Created 11 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 | « chrome/common/gtk_tree.h ('k') | chrome/common/temp_scaffolding_stubs.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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/common/property_bag.h" 5 #include "chrome/common/property_bag.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 TEST(PropertyBagTest, AddQueryRemove) { 8 TEST(PropertyBagTest, AddQueryRemove) {
9 PropertyBag bag; 9 PropertyBag bag;
10 PropertyAccessor<int> adaptor; 10 PropertyAccessor<int> adaptor;
11 11
12 // Should be no match initially. 12 // Should be no match initially.
13 EXPECT_TRUE(NULL == adaptor.GetProperty(&bag)); 13 EXPECT_EQ(NULL, adaptor.GetProperty(&bag));
14 14
15 // Add the value and make sure we get it back. 15 // Add the value and make sure we get it back.
16 const int kFirstValue = 1; 16 const int kFirstValue = 1;
17 adaptor.SetProperty(&bag, kFirstValue); 17 adaptor.SetProperty(&bag, kFirstValue);
18 ASSERT_TRUE(adaptor.GetProperty(&bag)); 18 ASSERT_TRUE(adaptor.GetProperty(&bag));
19 EXPECT_EQ(kFirstValue, *adaptor.GetProperty(&bag)); 19 EXPECT_EQ(kFirstValue, *adaptor.GetProperty(&bag));
20 20
21 // Set it to a new value. 21 // Set it to a new value.
22 const int kSecondValue = 2; 22 const int kSecondValue = 2;
23 adaptor.SetProperty(&bag, kSecondValue); 23 adaptor.SetProperty(&bag, kSecondValue);
24 ASSERT_TRUE(adaptor.GetProperty(&bag)); 24 ASSERT_TRUE(adaptor.GetProperty(&bag));
25 EXPECT_EQ(kSecondValue, *adaptor.GetProperty(&bag)); 25 EXPECT_EQ(kSecondValue, *adaptor.GetProperty(&bag));
26 26
27 // Remove the value and make sure it's gone. 27 // Remove the value and make sure it's gone.
28 adaptor.DeleteProperty(&bag); 28 adaptor.DeleteProperty(&bag);
29 EXPECT_TRUE(NULL == adaptor.GetProperty(&bag)); 29 EXPECT_EQ(NULL, adaptor.GetProperty(&bag));
30 } 30 }
31 31
32 TEST(PropertyBagTest, Copy) { 32 TEST(PropertyBagTest, Copy) {
33 PropertyAccessor<int> adaptor1; 33 PropertyAccessor<int> adaptor1;
34 PropertyAccessor<double> adaptor2; 34 PropertyAccessor<double> adaptor2;
35 35
36 // Create a bag with property type 1 in it. 36 // Create a bag with property type 1 in it.
37 PropertyBag copy; 37 PropertyBag copy;
38 adaptor1.SetProperty(&copy, 22); 38 adaptor1.SetProperty(&copy, 22);
39 39
(...skipping 10 matching lines...) Expand all
50 } 50 }
51 51
52 // Verify the copy got the two properties. 52 // Verify the copy got the two properties.
53 ASSERT_TRUE(adaptor1.GetProperty(&copy)); 53 ASSERT_TRUE(adaptor1.GetProperty(&copy));
54 ASSERT_TRUE(adaptor2.GetProperty(&copy)); 54 ASSERT_TRUE(adaptor2.GetProperty(&copy));
55 EXPECT_EQ(kType1Value, *adaptor1.GetProperty(&copy)); 55 EXPECT_EQ(kType1Value, *adaptor1.GetProperty(&copy));
56 EXPECT_EQ(kType2Value, *adaptor2.GetProperty(&copy)); 56 EXPECT_EQ(kType2Value, *adaptor2.GetProperty(&copy));
57 57
58 // Clear it out, neither property should be left. 58 // Clear it out, neither property should be left.
59 copy = PropertyBag(); 59 copy = PropertyBag();
60 EXPECT_TRUE(NULL == adaptor1.GetProperty(&copy)); 60 EXPECT_EQ(NULL, adaptor1.GetProperty(&copy));
61 EXPECT_TRUE(NULL == adaptor2.GetProperty(&copy)); 61 EXPECT_EQ(NULL, adaptor2.GetProperty(&copy));
62 } 62 }
OLDNEW
« no previous file with comments | « chrome/common/gtk_tree.h ('k') | chrome/common/temp_scaffolding_stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698