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

Side by Side Diff: mojo/public/cpp/bindings/tests/array_unittest.cc

Issue 1519673002: Add helpers for logging mojom objects. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase Created 5 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
« no previous file with comments | « mojo/public/cpp/bindings/struct_ptr.h ('k') | mojo/public/cpp/bindings/tests/map_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/public/cpp/bindings/array.h" 5 #include "mojo/public/cpp/bindings/array.h"
6 #include "mojo/public/cpp/bindings/lib/array_internal.h" 6 #include "mojo/public/cpp/bindings/lib/array_internal.h"
7 #include "mojo/public/cpp/bindings/lib/array_serialization.h" 7 #include "mojo/public/cpp/bindings/lib/array_serialization.h"
8 #include "mojo/public/cpp/bindings/lib/fixed_buffer.h" 8 #include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
9 #include "mojo/public/cpp/bindings/tests/container_test_util.h" 9 #include "mojo/public/cpp/bindings/tests/container_test_util.h"
10 #include "mojo/public/cpp/bindings/tests/iterator_test_util.h" 10 #include "mojo/public/cpp/bindings/tests/iterator_test_util.h"
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 EXPECT_EQ(-3, array3[0]->width); 821 EXPECT_EQ(-3, array3[0]->width);
822 EXPECT_EQ(-4, array3[0]->height); 822 EXPECT_EQ(-4, array3[0]->height);
823 EXPECT_FALSE(array3[1].is_null()); 823 EXPECT_FALSE(array3[1].is_null());
824 EXPECT_EQ(1, array3[1]->x); 824 EXPECT_EQ(1, array3[1]->x);
825 EXPECT_EQ(2, array3[1]->y); 825 EXPECT_EQ(2, array3[1]->y);
826 EXPECT_EQ(3, array3[1]->width); 826 EXPECT_EQ(3, array3[1]->width);
827 EXPECT_EQ(4, array3[1]->height); 827 EXPECT_EQ(4, array3[1]->height);
828 } 828 }
829 } 829 }
830 830
831 TEST_F(ArrayTest, OutputFormatting) {
832 Array<int32_t> null_array;
833 Array<int32_t> empty_array;
834 empty_array.resize(0);
835 Array<int32_t> one_element_array;
836 one_element_array.push_back(123);
837 Array<int32_t> three_element_array;
838 three_element_array.push_back(4);
839 three_element_array.push_back(5);
840 three_element_array.push_back(6);
841
842 std::ostringstream so;
843 so << "null_array=" << null_array << ", empty_array=" << empty_array
844 << ", one_element_array=" << one_element_array
845 << ", three_element_array=" << three_element_array;
846
847 EXPECT_EQ(
848 "null_array=null, "
849 "empty_array=[], "
850 "one_element_array=[123], "
851 "three_element_array=[4, 5, 6]",
852 so.str());
853 }
854
831 } // namespace 855 } // namespace
832 } // namespace test 856 } // namespace test
833 } // namespace mojo 857 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/struct_ptr.h ('k') | mojo/public/cpp/bindings/tests/map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698