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

Side by Side Diff: components/tracing/test/proto_zero_generation_unittest.cc

Issue 2691393002: Fix auto raw pointer deduction on linux (Closed)
Patch Set: rebase Created 3 years, 10 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
« no previous file with comments | « components/toolbar/toolbar_model_impl.cc ('k') | components/update_client/update_response.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <limits> 5 #include <limits>
6 #include <memory> 6 #include <memory>
7 #include <vector> 7 #include <vector>
8 8
9 #include "components/tracing/core/proto_zero_message_handle.h" 9 #include "components/tracing/core/proto_zero_message_handle.h"
10 #include "components/tracing/test/example_proto/library.pbzero.h" 10 #include "components/tracing/test/example_proto/library.pbzero.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return buffer_->GetBytes(start, length, buffer); 60 return buffer_->GetBytes(start, length, buffer);
61 } 61 }
62 62
63 private: 63 private:
64 std::unique_ptr<FakeScatteredBuffer> buffer_; 64 std::unique_ptr<FakeScatteredBuffer> buffer_;
65 std::unique_ptr<ScatteredStreamWriter> stream_writer_; 65 std::unique_ptr<ScatteredStreamWriter> stream_writer_;
66 std::vector<std::unique_ptr<ProtoZeroMessage>> root_messages_; 66 std::vector<std::unique_ptr<ProtoZeroMessage>> root_messages_;
67 }; 67 };
68 68
69 TEST_F(ProtoZeroConformanceTest, SimpleFieldsNoNesting) { 69 TEST_F(ProtoZeroConformanceTest, SimpleFieldsNoNesting) {
70 auto msg = CreateMessage<pbtest::EveryField>(); 70 auto* msg = CreateMessage<pbtest::EveryField>();
71 71
72 msg->set_field_int32(-1); 72 msg->set_field_int32(-1);
73 msg->set_field_int64(-333123456789ll); 73 msg->set_field_int64(-333123456789ll);
74 msg->set_field_uint32(600); 74 msg->set_field_uint32(600);
75 msg->set_field_uint64(333123456789ll); 75 msg->set_field_uint64(333123456789ll);
76 msg->set_field_sint32(-5); 76 msg->set_field_sint32(-5);
77 msg->set_field_sint64(-9000); 77 msg->set_field_sint64(-9000);
78 msg->set_field_fixed32(12345); 78 msg->set_field_fixed32(12345);
79 msg->set_field_fixed64(444123450000ll); 79 msg->set_field_fixed64(444123450000ll);
80 msg->set_field_sfixed32(-69999); 80 msg->set_field_sfixed32(-69999);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 EXPECT_EQ("FizzBuzz", gold_msg.field_string()); 119 EXPECT_EQ("FizzBuzz", gold_msg.field_string());
120 EXPECT_EQ(std::string("\x11\x00\xBE\xEF", 4), gold_msg.field_bytes()); 120 EXPECT_EQ(std::string("\x11\x00\xBE\xEF", 4), gold_msg.field_bytes());
121 EXPECT_EQ(4, gold_msg.repeated_int32_size()); 121 EXPECT_EQ(4, gold_msg.repeated_int32_size());
122 EXPECT_EQ(1, gold_msg.repeated_int32(0)); 122 EXPECT_EQ(1, gold_msg.repeated_int32(0));
123 EXPECT_EQ(-1, gold_msg.repeated_int32(1)); 123 EXPECT_EQ(-1, gold_msg.repeated_int32(1));
124 EXPECT_EQ(100, gold_msg.repeated_int32(2)); 124 EXPECT_EQ(100, gold_msg.repeated_int32(2));
125 EXPECT_EQ(2000000, gold_msg.repeated_int32(3)); 125 EXPECT_EQ(2000000, gold_msg.repeated_int32(3));
126 } 126 }
127 127
128 TEST_F(ProtoZeroConformanceTest, NestedMessages) { 128 TEST_F(ProtoZeroConformanceTest, NestedMessages) {
129 auto msg_a = CreateMessage<pbtest::NestedA>(); 129 auto* msg_a = CreateMessage<pbtest::NestedA>();
130 130
131 pbtest::NestedA::NestedB* msg_b = msg_a->add_repeated_a(); 131 pbtest::NestedA::NestedB* msg_b = msg_a->add_repeated_a();
132 pbtest::NestedA::NestedB::NestedC* msg_c = msg_b->set_value_b(); 132 pbtest::NestedA::NestedB::NestedC* msg_c = msg_b->set_value_b();
133 msg_c->set_value_c(321); 133 msg_c->set_value_c(321);
134 msg_b = msg_a->add_repeated_a(); 134 msg_b = msg_a->add_repeated_a();
135 msg_c = msg_a->set_super_nested(); 135 msg_c = msg_a->set_super_nested();
136 msg_c->set_value_c(1000); 136 msg_c->set_value_c(1000);
137 msg_a->Finalize(); 137 msg_a->Finalize();
138 138
139 size_t msg_size = GetNumSerializedBytes(); 139 size_t msg_size = GetNumSerializedBytes();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 EXPECT_EQ(ProtoFieldDescriptor::Type::TYPE_INT32, reflection->type()); 175 EXPECT_EQ(ProtoFieldDescriptor::Type::TYPE_INT32, reflection->type());
176 EXPECT_EQ(1u, reflection->number()); 176 EXPECT_EQ(1u, reflection->number());
177 EXPECT_FALSE(reflection->is_repeated()); 177 EXPECT_FALSE(reflection->is_repeated());
178 EXPECT_TRUE(reflection->is_valid()); 178 EXPECT_TRUE(reflection->is_valid());
179 179
180 EXPECT_FALSE(pbtest::TransgalacticParcel::GetFieldDescriptor(42)->is_valid()); 180 EXPECT_FALSE(pbtest::TransgalacticParcel::GetFieldDescriptor(42)->is_valid());
181 } 181 }
182 182
183 } // namespace proto 183 } // namespace proto
184 } // namespace tracing 184 } // namespace tracing
OLDNEW
« no previous file with comments | « components/toolbar/toolbar_model_impl.cc ('k') | components/update_client/update_response.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698