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

Side by Side Diff: chromeos/dbus/ibus/ibus_property_unittest.cc

Issue 10797017: base: Make ScopedVector::clear() destroy elements. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update location_bar_view_mac.mm Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/dbus/ibus/ibus_property.cc ('k') | content/browser/geolocation/location_arbitrator.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 #include "chromeos/dbus/ibus/ibus_property.h" 4 #include "chromeos/dbus/ibus/ibus_property.h"
5 5
6 #include <string> 6 #include <string>
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 20 matching lines...) Expand all
31 // This function clears IBusProperty::sub_properties_ and does not add any 31 // This function clears IBusProperty::sub_properties_ and does not add any
32 // entries into it. The testing data can be checked with CheckProperty function 32 // entries into it. The testing data can be checked with CheckProperty function
33 // with same |prefix|. 33 // with same |prefix|.
34 void SetProperty(const std::string& prefix, IBusProperty* property) { 34 void SetProperty(const std::string& prefix, IBusProperty* property) {
35 property->set_key(prefix + kSampleKey); 35 property->set_key(prefix + kSampleKey);
36 property->set_type(kSampleType); 36 property->set_type(kSampleType);
37 property->set_label(prefix + kSampleLabel); 37 property->set_label(prefix + kSampleLabel);
38 property->set_tooltip(prefix + kSampleTooltip); 38 property->set_tooltip(prefix + kSampleTooltip);
39 property->set_visible(kSampleVisible); 39 property->set_visible(kSampleVisible);
40 property->set_checked(kSampleChecked); 40 property->set_checked(kSampleChecked);
41 property->mutable_sub_properties()->reset(); 41 property->mutable_sub_properties()->clear();
42 } 42 }
43 43
44 // Checks testing data in |property| with |prefix|. 44 // Checks testing data in |property| with |prefix|.
45 // This function does not check IBusProperty::sub_properties_. 45 // This function does not check IBusProperty::sub_properties_.
46 bool CheckProperty(const std::string& prefix, const IBusProperty& property) { 46 bool CheckProperty(const std::string& prefix, const IBusProperty& property) {
47 if ((prefix + kSampleKey) != property.key()) { 47 if ((prefix + kSampleKey) != property.key()) {
48 LOG(ERROR) << "Does not match IBusProperty::key value: " << std::endl 48 LOG(ERROR) << "Does not match IBusProperty::key value: " << std::endl
49 << "Expected: " << (prefix + kSampleKey) << std::endl 49 << "Expected: " << (prefix + kSampleKey) << std::endl
50 << "Actual: " << property.key(); 50 << "Actual: " << property.key();
51 return false; 51 return false;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 const IBusPropertyList& sub_properties = target_property.sub_properties(); 113 const IBusPropertyList& sub_properties = target_property.sub_properties();
114 ASSERT_EQ(kSubPropertyCount, sub_properties.size()); 114 ASSERT_EQ(kSubPropertyCount, sub_properties.size());
115 for (size_t i = 0; i < kSubPropertyCount; ++i) { 115 for (size_t i = 0; i < kSubPropertyCount; ++i) {
116 const std::string prefix = "Sub" + base::Uint64ToString(i); 116 const std::string prefix = "Sub" + base::Uint64ToString(i);
117 EXPECT_TRUE(CheckProperty(prefix, *(sub_properties[i]))); 117 EXPECT_TRUE(CheckProperty(prefix, *(sub_properties[i])));
118 } 118 }
119 } 119 }
120 120
121 } // namespace ibus 121 } // namespace ibus
122 } // namespace chromeos 122 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/ibus/ibus_property.cc ('k') | content/browser/geolocation/location_arbitrator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698