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

Side by Side Diff: content/common/page_state_serialization_unittest.cc

Issue 102843002: Move RemoveChars, ReplaceChars, TrimString, and TruncateUTF8ToByteSize to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <math.h> 5 #include <math.h>
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 path = path.AppendASCII("page_state").AppendASCII( 201 path = path.AppendASCII("page_state").AppendASCII(
202 base::StringPrintf("serialized_v%d%s.dat", version, suffix)); 202 base::StringPrintf("serialized_v%d%s.dat", version, suffix));
203 203
204 std::string file_contents; 204 std::string file_contents;
205 if (!base::ReadFileToString(path, &file_contents)) { 205 if (!base::ReadFileToString(path, &file_contents)) {
206 ADD_FAILURE() << "File not found: " << path.value(); 206 ADD_FAILURE() << "File not found: " << path.value();
207 return; 207 return;
208 } 208 }
209 209
210 std::string trimmed_contents; 210 std::string trimmed_contents;
211 EXPECT_TRUE(RemoveChars(file_contents, "\r\n", &trimmed_contents)); 211 EXPECT_TRUE(base::RemoveChars(file_contents, "\r\n", &trimmed_contents));
212 212
213 std::string encoded; 213 std::string encoded;
214 EXPECT_TRUE(base::Base64Decode(trimmed_contents, &encoded)); 214 EXPECT_TRUE(base::Base64Decode(trimmed_contents, &encoded));
215 215
216 ExplodedPageState output; 216 ExplodedPageState output;
217 #if defined(OS_ANDROID) 217 #if defined(OS_ANDROID)
218 // Because version 11 of the file format unfortunately bakes in the device 218 // Because version 11 of the file format unfortunately bakes in the device
219 // scale factor on Android, perform this test by assuming a preset device 219 // scale factor on Android, perform this test by assuming a preset device
220 // scale factor, ignoring the device scale factor of the current device. 220 // scale factor, ignoring the device scale factor of the current device.
221 const float kPresetDeviceScaleFactor = 2.0f; 221 const float kPresetDeviceScaleFactor = 2.0f;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 TEST_F(PageStateSerializationTest, BackwardsCompat_v15) { 416 TEST_F(PageStateSerializationTest, BackwardsCompat_v15) {
417 TestBackwardsCompat(15); 417 TestBackwardsCompat(15);
418 } 418 }
419 419
420 TEST_F(PageStateSerializationTest, BackwardsCompat_v16) { 420 TEST_F(PageStateSerializationTest, BackwardsCompat_v16) {
421 TestBackwardsCompat(16); 421 TestBackwardsCompat(16);
422 } 422 }
423 423
424 } // namespace 424 } // namespace
425 } // namespace content 425 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698