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

Side by Side Diff: third_party/WebKit/Source/core/testing/UnionTypesTest.cpp

Issue 2025503002: Revert of Expand WTF::StringView's API to be more like StringPiece. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 // 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 "core/testing/UnionTypesTest.h" 5 #include "core/testing/UnionTypesTest.h"
6 6
7 #include "wtf/text/StringBuilder.h" 7 #include "wtf/text/StringBuilder.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 69
70 String UnionTypesTest::doubleOrStringArrayArg(HeapVector<DoubleOrString>& array) 70 String UnionTypesTest::doubleOrStringArrayArg(HeapVector<DoubleOrString>& array)
71 { 71 {
72 if (!array.size()) 72 if (!array.size())
73 return ""; 73 return "";
74 74
75 StringBuilder builder; 75 StringBuilder builder;
76 for (DoubleOrString& doubleOrString : array) { 76 for (DoubleOrString& doubleOrString : array) {
77 ASSERT(!doubleOrString.isNull()); 77 ASSERT(!doubleOrString.isNull());
78 if (doubleOrString.isDouble()) { 78 if (doubleOrString.isDouble())
79 builder.append("double: "); 79 builder.append("double: " + String::numberToStringECMAScript(doubleO rString.getAsDouble()));
80 builder.append(String::numberToStringECMAScript(doubleOrString.getAs Double())); 80 else if (doubleOrString.isString())
81 } else if (doubleOrString.isString()) { 81 builder.append("string: " + doubleOrString.getAsString());
82 builder.append("string: "); 82 else
83 builder.append(doubleOrString.getAsString());
84 } else {
85 ASSERT_NOT_REACHED(); 83 ASSERT_NOT_REACHED();
86 }
87 builder.append(", "); 84 builder.append(", ");
88 } 85 }
89 return builder.substring(0, builder.length() - 2); 86 return builder.substring(0, builder.length() - 2);
90 } 87 }
91 88
92 String UnionTypesTest::doubleOrStringSequenceArg(HeapVector<DoubleOrString>& seq uence) 89 String UnionTypesTest::doubleOrStringSequenceArg(HeapVector<DoubleOrString>& seq uence)
93 { 90 {
94 return doubleOrStringArrayArg(sequence); 91 return doubleOrStringArrayArg(sequence);
95 } 92 }
96 93
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 builder.append("sequence: ["); 153 builder.append("sequence: [");
157 for (const String& item : sequence) { 154 for (const String& item : sequence) {
158 ASSERT(!item.isNull()); 155 ASSERT(!item.isNull());
159 builder.append(item); 156 builder.append(item);
160 builder.append(", "); 157 builder.append(", ");
161 } 158 }
162 return builder.substring(0, builder.length() - 2) + "]"; 159 return builder.substring(0, builder.length() - 2) + "]";
163 } 160 }
164 161
165 } // namespace blink 162 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698