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

Unified Diff: base/values_unittest.cc

Issue 851673003: Cleanup: Some simplifications in json_schema_compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_dart_tests
Patch Set: Add unit test for GetAsBinary. Created 5 years, 11 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
Index: base/values_unittest.cc
diff --git a/base/values_unittest.cc b/base/values_unittest.cc
index 296880ac6c8db56bddac8e1c77d2c55787812adc..93fe142e423e9bd21b18dfc39c180c14d2edb5d5 100644
--- a/base/values_unittest.cc
+++ b/base/values_unittest.cc
@@ -127,6 +127,16 @@ TEST(ValuesTest, BinaryValue) {
ASSERT_NE(stack_buffer, binary->GetBuffer());
ASSERT_EQ(42U, binary->GetSize());
ASSERT_EQ(0, memcmp(stack_buffer, binary->GetBuffer(), binary->GetSize()));
+
+ { // Test overloaded GetAsBinary.
+ std::string buffer("abcdefg");
+ scoped_ptr<BinaryValue> binary(
+ BinaryValue::CreateWithCopiedBuffer(buffer.data(), buffer.size()));
+ Value* narrow_value = binary.get();
+ std::string narrow;
+ ASSERT_TRUE(narrow_value->GetAsBinary(&narrow));
+ EXPECT_EQ(buffer, narrow);
+ }
}
TEST(ValuesTest, StringValue) {
« base/values.h ('K') | « base/values.cc ('k') | tools/json_schema_compiler/cc_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698