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

Side by Side Diff: third_party/protobuf/src/google/protobuf/util/internal/json_objectwriter_test.cc

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years 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
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 // Test that we get regular (non websafe) base64 encoding on byte fields by 292 // Test that we get regular (non websafe) base64 encoding on byte fields by
293 // default. 293 // default.
294 EXPECT_EQ("{\"bytes\":\"A+/A\"}", 294 EXPECT_EQ("{\"bytes\":\"A+/A\"}",
295 output_.substr(0, out_stream_->ByteCount())); 295 output_.substr(0, out_stream_->ByteCount()));
296 } 296 }
297 297
298 TEST_F(JsonObjectWriterTest, TestWebsafeByteEncoding) { 298 TEST_F(JsonObjectWriterTest, TestWebsafeByteEncoding) {
299 ow_ = new JsonObjectWriter("", out_stream_); 299 ow_ = new JsonObjectWriter("", out_stream_);
300 ow_->set_use_websafe_base64_for_bytes(true); 300 ow_->set_use_websafe_base64_for_bytes(true);
301 ow_->StartObject("") 301 ow_->StartObject("")
302 ->RenderBytes("bytes", "\x03\xef\xc0") 302 ->RenderBytes("bytes", "\x03\xef\xc0\x10")
303 ->EndObject(); 303 ->EndObject();
304 304
305 // Test that we get websafe base64 encoding when explicitly asked. 305 // Test that we get websafe base64 encoding when explicitly asked.
306 EXPECT_EQ("{\"bytes\":\"A-_A\"}", 306 EXPECT_EQ("{\"bytes\":\"A-_AEA==\"}",
307 output_.substr(0, out_stream_->ByteCount())); 307 output_.substr(0, out_stream_->ByteCount()));
308 } 308 }
309 309
310 } // namespace converter 310 } // namespace converter
311 } // namespace util 311 } // namespace util
312 } // namespace protobuf 312 } // namespace protobuf
313 } // namespace google 313 } // namespace google
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698