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

Side by Side Diff: chrome/browser/extensions/api/record/record_api_test.cc

Issue 19052005: Move PathIsWritable, DirectoryExists, ContentsEqual, and TextContentsEqual to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 "chrome/browser/extensions/api/record/record_api.h" 5 #include "chrome/browser/extensions/api/record/record_api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 temp_files_->push_back(url_path); 99 temp_files_->push_back(url_path);
100 if (command_line.HasSwitch(switches::kRecordMode) || 100 if (command_line.HasSwitch(switches::kRecordMode) ||
101 command_line.HasSwitch(switches::kPlaybackMode)) { 101 command_line.HasSwitch(switches::kPlaybackMode)) {
102 base::FilePath url_path_copy = command_line.GetSwitchValuePath( 102 base::FilePath url_path_copy = command_line.GetSwitchValuePath(
103 switches::kUserDataDir).Append( 103 switches::kUserDataDir).Append(
104 base::FilePath(base::FilePath::StringType(kMockCacheFile))); 104 base::FilePath(base::FilePath::StringType(kMockCacheFile)));
105 105
106 if (command_line.HasSwitch(switches::kRecordMode)) { 106 if (command_line.HasSwitch(switches::kRecordMode)) {
107 base::CopyFile(url_path, url_path_copy); 107 base::CopyFile(url_path, url_path_copy);
108 } else { 108 } else {
109 if (!file_util::ContentsEqual(url_path, url_path_copy)) { 109 if (!base::ContentsEqual(url_path, url_path_copy)) {
110 std::string contents1, contents2; 110 std::string contents1, contents2;
111 file_util::ReadFileToString(url_path, &contents1); 111 file_util::ReadFileToString(url_path, &contents1);
112 file_util::ReadFileToString(url_path_copy, &contents2); 112 file_util::ReadFileToString(url_path_copy, &contents2);
113 LOG(ERROR) << "FILE MISMATCH" << contents1 << " VS " << contents2; 113 LOG(ERROR) << "FILE MISMATCH" << contents1 << " VS " << contents2;
114 } 114 }
115 EXPECT_TRUE(file_util::ContentsEqual(url_path, url_path_copy)); 115 EXPECT_TRUE(base::ContentsEqual(url_path, url_path_copy));
116 } 116 }
117 } 117 }
118 118
119 std::string urls; 119 std::string urls;
120 file_util::ReadFileToString(url_path, &urls); 120 file_util::ReadFileToString(url_path, &urls);
121 121
122 std::vector<std::string> url_vector, bad_urls; 122 std::vector<std::string> url_vector, bad_urls;
123 base::SplitString(urls, '\n', &url_vector); 123 base::SplitString(urls, '\n', &url_vector);
124 for (std::vector<std::string>::iterator itr = url_vector.begin(); 124 for (std::vector<std::string>::iterator itr = url_vector.begin();
125 itr != url_vector.end(); ++itr) { 125 itr != url_vector.end(); ++itr) {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 // Check for return value with proper stats. 345 // Check for return value with proper stats.
346 EXPECT_EQ(kTestStatistics, utils::GetString(result.get(), kStatsKey)); 346 EXPECT_EQ(kTestStatistics, utils::GetString(result.get(), kStatsKey));
347 347
348 base::ListValue* errors = NULL; 348 base::ListValue* errors = NULL;
349 EXPECT_TRUE(result->GetList(kErrorsKey, &errors)); 349 EXPECT_TRUE(result->GetList(kErrorsKey, &errors));
350 EXPECT_TRUE(VerifyURLHandling(errors, strategy)); 350 EXPECT_TRUE(VerifyURLHandling(errors, strategy));
351 } 351 }
352 352
353 } // namespace extensions 353 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698