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

Unified Diff: base/values_unittest.cc

Issue 6893089: Modified Value::GetAsDouble so the function returns true when the object holds an Integer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fix Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/values.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values_unittest.cc
diff --git a/base/values_unittest.cc b/base/values_unittest.cc
index 809fe901284bbb9906e9715535fdf44d661ab03d..5fac826d1cee1bef965c7f2777fed21f39dd7c3a 100644
--- a/base/values_unittest.cc
+++ b/base/values_unittest.cc
@@ -74,10 +74,12 @@ TEST_F(ValuesTest, List) {
ASSERT_FALSE(mixed_list->GetInteger(0, &int_value));
ASSERT_EQ(0, int_value);
- ASSERT_FALSE(mixed_list->GetDouble(1, &double_value));
- ASSERT_EQ(0.0, double_value);
+ ASSERT_FALSE(mixed_list->GetBoolean(1, &bool_value));
+ ASSERT_FALSE(bool_value);
ASSERT_FALSE(mixed_list->GetString(2, &string_value));
ASSERT_EQ("", string_value);
+ ASSERT_FALSE(mixed_list->GetInteger(2, &int_value));
+ ASSERT_EQ(0, int_value);
ASSERT_FALSE(mixed_list->GetBoolean(3, &bool_value));
ASSERT_FALSE(bool_value);
@@ -85,6 +87,9 @@ TEST_F(ValuesTest, List) {
ASSERT_TRUE(bool_value);
ASSERT_TRUE(mixed_list->GetInteger(1, &int_value));
ASSERT_EQ(42, int_value);
+ // implicit conversion from Integer to Double should be possible.
+ ASSERT_TRUE(mixed_list->GetDouble(1, &double_value));
+ ASSERT_EQ(42, double_value);
ASSERT_TRUE(mixed_list->GetDouble(2, &double_value));
ASSERT_EQ(88.8, double_value);
ASSERT_TRUE(mixed_list->GetString(3, &string_value));
« no previous file with comments | « base/values.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698