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

Side by Side Diff: webkit/glue/glue_serialize_unittest.cc

Issue 13219005: Replace string16 with base::string16 in src/webkit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 6
7 #include "base/pickle.h" 7 #include "base/pickle.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebHTTPBody.h" 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebHTTPBody.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 float expectedPageScaleFactor = a.pageScaleFactor(); 112 float expectedPageScaleFactor = a.pageScaleFactor();
113 WebPoint expectedScrollOffset = a.scrollOffset(); 113 WebPoint expectedScrollOffset = a.scrollOffset();
114 #if defined(OS_ANDROID) 114 #if defined(OS_ANDROID)
115 if (version == 11) { 115 if (version == 11) {
116 expectedScrollOffset.x /= a.pageScaleFactor(); 116 expectedScrollOffset.x /= a.pageScaleFactor();
117 expectedScrollOffset.y /= a.pageScaleFactor(); 117 expectedScrollOffset.y /= a.pageScaleFactor();
118 expectedPageScaleFactor /= gfx::Screen::GetNativeScreen() 118 expectedPageScaleFactor /= gfx::Screen::GetNativeScreen()
119 ->GetPrimaryDisplay().device_scale_factor(); 119 ->GetPrimaryDisplay().device_scale_factor();
120 } 120 }
121 #endif 121 #endif
122 EXPECT_EQ(string16(a.urlString()), string16(b.urlString())); 122 EXPECT_EQ(base::string16(a.urlString()), base::string16(b.urlString()));
123 EXPECT_EQ(string16(a.originalURLString()), string16(b.originalURLString())); 123 EXPECT_EQ(base::string16(a.originalURLString()),
124 EXPECT_EQ(string16(a.target()), string16(b.target())); 124 base::string16(b.originalURLString()));
125 EXPECT_EQ(string16(a.parent()), string16(b.parent())); 125 EXPECT_EQ(base::string16(a.target()), base::string16(b.target()));
126 EXPECT_EQ(string16(a.title()), string16(b.title())); 126 EXPECT_EQ(base::string16(a.parent()), base::string16(b.parent()));
127 EXPECT_EQ(string16(a.alternateTitle()), string16(b.alternateTitle())); 127 EXPECT_EQ(base::string16(a.title()), base::string16(b.title()));
128 EXPECT_EQ(base::string16(a.alternateTitle()),
129 base::string16(b.alternateTitle()));
128 EXPECT_EQ(a.lastVisitedTime(), b.lastVisitedTime()); 130 EXPECT_EQ(a.lastVisitedTime(), b.lastVisitedTime());
129 EXPECT_EQ(expectedScrollOffset, b.scrollOffset()); 131 EXPECT_EQ(expectedScrollOffset, b.scrollOffset());
130 EXPECT_EQ(a.isTargetItem(), b.isTargetItem()); 132 EXPECT_EQ(a.isTargetItem(), b.isTargetItem());
131 EXPECT_EQ(a.visitCount(), b.visitCount()); 133 EXPECT_EQ(a.visitCount(), b.visitCount());
132 EXPECT_EQ(string16(a.referrer()), string16(b.referrer())); 134 EXPECT_EQ(base::string16(a.referrer()), base::string16(b.referrer()));
133 if (version >= 11) 135 if (version >= 11)
134 EXPECT_EQ(expectedPageScaleFactor, b.pageScaleFactor()); 136 EXPECT_EQ(expectedPageScaleFactor, b.pageScaleFactor());
135 if (version >= 9) 137 if (version >= 9)
136 EXPECT_EQ(a.itemSequenceNumber(), b.itemSequenceNumber()); 138 EXPECT_EQ(a.itemSequenceNumber(), b.itemSequenceNumber());
137 if (version >= 6) 139 if (version >= 6)
138 EXPECT_EQ(a.documentSequenceNumber(), b.documentSequenceNumber()); 140 EXPECT_EQ(a.documentSequenceNumber(), b.documentSequenceNumber());
139 141
140 const WebVector<WebString>& a_docstate = a.documentState(); 142 const WebVector<WebString>& a_docstate = a.documentState();
141 const WebVector<WebString>& b_docstate = b.documentState(); 143 const WebVector<WebString>& b_docstate = b.documentState();
142 EXPECT_EQ(a_docstate.size(), b_docstate.size()); 144 EXPECT_EQ(a_docstate.size(), b_docstate.size());
143 for (size_t i = 0, c = a_docstate.size(); i < c; ++i) 145 for (size_t i = 0, c = a_docstate.size(); i < c; ++i)
144 EXPECT_EQ(string16(a_docstate[i]), string16(b_docstate[i])); 146 EXPECT_EQ(base::string16(a_docstate[i]), base::string16(b_docstate[i]));
145 } 147 }
146 148
147 void HistoryItemExpectFormDataEqual(const WebHistoryItem& a, 149 void HistoryItemExpectFormDataEqual(const WebHistoryItem& a,
148 const WebHistoryItem& b) { 150 const WebHistoryItem& b) {
149 const WebHTTPBody& a_body = a.httpBody(); 151 const WebHTTPBody& a_body = a.httpBody();
150 const WebHTTPBody& b_body = b.httpBody(); 152 const WebHTTPBody& b_body = b.httpBody();
151 EXPECT_EQ(!a_body.isNull(), !b_body.isNull()); 153 EXPECT_EQ(!a_body.isNull(), !b_body.isNull());
152 if (!a_body.isNull() && !b_body.isNull()) { 154 if (!a_body.isNull() && !b_body.isNull()) {
153 EXPECT_EQ(a_body.containsPasswordData(), b_body.containsPasswordData()); 155 EXPECT_EQ(a_body.containsPasswordData(), b_body.containsPasswordData());
154 EXPECT_EQ(a_body.elementCount(), b_body.elementCount()); 156 EXPECT_EQ(a_body.elementCount(), b_body.elementCount());
155 WebHTTPBody::Element a_elem, b_elem; 157 WebHTTPBody::Element a_elem, b_elem;
156 for (size_t i = 0; a_body.elementAt(i, a_elem) && 158 for (size_t i = 0; a_body.elementAt(i, a_elem) &&
157 b_body.elementAt(i, b_elem); ++i) { 159 b_body.elementAt(i, b_elem); ++i) {
158 EXPECT_EQ(a_elem.type, b_elem.type); 160 EXPECT_EQ(a_elem.type, b_elem.type);
159 if (a_elem.type == WebHTTPBody::Element::TypeData) { 161 if (a_elem.type == WebHTTPBody::Element::TypeData) {
160 EXPECT_EQ(std::string(a_elem.data.data(), a_elem.data.size()), 162 EXPECT_EQ(std::string(a_elem.data.data(), a_elem.data.size()),
161 std::string(b_elem.data.data(), b_elem.data.size())); 163 std::string(b_elem.data.data(), b_elem.data.size()));
162 } else { 164 } else {
163 EXPECT_EQ(string16(a_elem.filePath), string16(b_elem.filePath)); 165 EXPECT_EQ(base::string16(a_elem.filePath),
166 base::string16(b_elem.filePath));
164 } 167 }
165 } 168 }
166 } 169 }
167 EXPECT_EQ(string16(a.httpContentType()), string16(b.httpContentType())); 170 EXPECT_EQ(base::string16(a.httpContentType()),
171 base::string16(b.httpContentType()));
168 } 172 }
169 173
170 void HistoryItemExpectChildrenEqual(const WebHistoryItem& a, 174 void HistoryItemExpectChildrenEqual(const WebHistoryItem& a,
171 const WebHistoryItem& b) { 175 const WebHistoryItem& b) {
172 const WebVector<WebHistoryItem>& a_children = a.children(); 176 const WebVector<WebHistoryItem>& a_children = a.children();
173 const WebVector<WebHistoryItem>& b_children = b.children(); 177 const WebVector<WebHistoryItem>& b_children = b.children();
174 EXPECT_EQ(a_children.size(), b_children.size()); 178 EXPECT_EQ(a_children.size(), b_children.size());
175 for (size_t i = 0, c = a_children.size(); i < c; ++i) 179 for (size_t i = 0, c = a_children.size(); i < c; ++i)
176 HistoryItemExpectEqual(a_children[i], b_children[i], 180 HistoryItemExpectEqual(a_children[i], b_children[i],
177 webkit_glue::HistoryItemCurrentVersion()); 181 webkit_glue::HistoryItemCurrentVersion());
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 345
342 ASSERT_FALSE(item1.isNull()); 346 ASSERT_FALSE(item1.isNull());
343 ASSERT_FALSE(item2.isNull()); 347 ASSERT_FALSE(item2.isNull());
344 348
345 // Form data was not removed. 349 // Form data was not removed.
346 HistoryItemExpectEqual(item1, item2, 350 HistoryItemExpectEqual(item1, item2,
347 webkit_glue::HistoryItemCurrentVersion()); 351 webkit_glue::HistoryItemCurrentVersion());
348 } 352 }
349 353
350 } // namespace 354 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698