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

Side by Side Diff: third_party/WebKit/Source/platform/text/DateTimeFormatTest.cpp

Issue 2615813003: Migrate WTF::Vector::append() to ::push_back() [part 14 of N] (Closed)
Patch Set: rebase, small fix in FontSettings.h Created 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 } 72 }
73 }; 73 };
74 74
75 class Tokens { 75 class Tokens {
76 public: 76 public:
77 Tokens() {} 77 Tokens() {}
78 78
79 explicit Tokens(const Vector<Token> tokens) : m_tokens(tokens) {} 79 explicit Tokens(const Vector<Token> tokens) : m_tokens(tokens) {}
80 80
81 explicit Tokens(const String& string) { m_tokens.append(Token(string)); } 81 explicit Tokens(const String& string) { m_tokens.push_back(Token(string)); }
82 82
83 explicit Tokens(Token token1) { m_tokens.append(token1); } 83 explicit Tokens(Token token1) { m_tokens.push_back(token1); }
84 84
85 Tokens(Token token1, Token token2) { 85 Tokens(Token token1, Token token2) {
86 m_tokens.append(token1); 86 m_tokens.push_back(token1);
87 m_tokens.append(token2); 87 m_tokens.push_back(token2);
88 } 88 }
89 89
90 Tokens(Token token1, Token token2, Token token3) { 90 Tokens(Token token1, Token token2, Token token3) {
91 m_tokens.append(token1); 91 m_tokens.push_back(token1);
92 m_tokens.append(token2); 92 m_tokens.push_back(token2);
93 m_tokens.append(token3); 93 m_tokens.push_back(token3);
94 } 94 }
95 95
96 Tokens(Token token1, Token token2, Token token3, Token token4) { 96 Tokens(Token token1, Token token2, Token token3, Token token4) {
97 m_tokens.append(token1); 97 m_tokens.push_back(token1);
98 m_tokens.append(token2); 98 m_tokens.push_back(token2);
99 m_tokens.append(token3); 99 m_tokens.push_back(token3);
100 m_tokens.append(token4); 100 m_tokens.push_back(token4);
101 } 101 }
102 102
103 Tokens(Token token1, 103 Tokens(Token token1,
104 Token token2, 104 Token token2,
105 Token token3, 105 Token token3,
106 Token token4, 106 Token token4,
107 Token token5) { 107 Token token5) {
108 m_tokens.append(token1); 108 m_tokens.push_back(token1);
109 m_tokens.append(token2); 109 m_tokens.push_back(token2);
110 m_tokens.append(token3); 110 m_tokens.push_back(token3);
111 m_tokens.append(token4); 111 m_tokens.push_back(token4);
112 m_tokens.append(token5); 112 m_tokens.push_back(token5);
113 } 113 }
114 114
115 Tokens(Token token1, 115 Tokens(Token token1,
116 Token token2, 116 Token token2,
117 Token token3, 117 Token token3,
118 Token token4, 118 Token token4,
119 Token token5, 119 Token token5,
120 Token token6) { 120 Token token6) {
121 m_tokens.append(token1); 121 m_tokens.push_back(token1);
122 m_tokens.append(token2); 122 m_tokens.push_back(token2);
123 m_tokens.append(token3); 123 m_tokens.push_back(token3);
124 m_tokens.append(token4); 124 m_tokens.push_back(token4);
125 m_tokens.append(token5); 125 m_tokens.push_back(token5);
126 m_tokens.append(token6); 126 m_tokens.push_back(token6);
127 } 127 }
128 128
129 bool operator==(const Tokens& other) const { 129 bool operator==(const Tokens& other) const {
130 return m_tokens == other.m_tokens; 130 return m_tokens == other.m_tokens;
131 } 131 }
132 132
133 String toString() const { 133 String toString() const {
134 StringBuilder builder; 134 StringBuilder builder;
135 builder.append("Tokens("); 135 builder.append("Tokens(");
136 for (unsigned index = 0; index < m_tokens.size(); ++index) { 136 for (unsigned index = 0; index < m_tokens.size(); ++index) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 FieldType getFieldType(int index) const { 172 FieldType getFieldType(int index) const {
173 return index >= 0 && index < static_cast<int>(m_tokens.size()) 173 return index >= 0 && index < static_cast<int>(m_tokens.size())
174 ? m_tokens[index].fieldType 174 ? m_tokens[index].fieldType
175 : DateTimeFormat::FieldTypeInvalid; 175 : DateTimeFormat::FieldTypeInvalid;
176 } 176 }
177 177
178 Tokens getTokens() const { return Tokens(m_tokens); } 178 Tokens getTokens() const { return Tokens(m_tokens); }
179 179
180 private: 180 private:
181 void visitField(FieldType fieldType, int count) override { 181 void visitField(FieldType fieldType, int count) override {
182 m_tokens.append(Token(fieldType, count)); 182 m_tokens.push_back(Token(fieldType, count));
183 } 183 }
184 184
185 void visitLiteral(const String& string) override { 185 void visitLiteral(const String& string) override {
186 m_tokens.append(Token(string)); 186 m_tokens.push_back(Token(string));
187 } 187 }
188 188
189 Vector<Token> m_tokens; 189 Vector<Token> m_tokens;
190 }; 190 };
191 }; 191 };
192 192
193 std::ostream& operator<<(std::ostream& os, 193 std::ostream& operator<<(std::ostream& os,
194 const DateTimeFormatTest::Tokens& tokens) { 194 const DateTimeFormatTest::Tokens& tokens) {
195 return os << tokens.toString().ascii().data(); 195 return os << tokens.toString().ascii().data();
196 } 196 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('O')); 295 EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('O'));
296 EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('P')); 296 EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('P'));
297 EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('R')); 297 EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('R'));
298 EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('T')); 298 EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('T'));
299 EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('U')); 299 EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('U'));
300 EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('V')); 300 EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('V'));
301 EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('X')); 301 EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('X'));
302 } 302 }
303 303
304 } // namespace blink 304 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/text/BidiResolver.h ('k') | third_party/WebKit/Source/platform/text/Hyphenation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698