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

Side by Side Diff: content/browser/dom_storage/dom_storage_database_unittest.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 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 "content/browser/dom_storage/dom_storage_database.h" 5 #include "content/browser/dom_storage/dom_storage_database.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 339 }
340 340
341 TEST(DOMStorageDatabaseTest, TestCanOpenFileThatIsNotADatabase) { 341 TEST(DOMStorageDatabaseTest, TestCanOpenFileThatIsNotADatabase) {
342 // Write into the temporary file first. 342 // Write into the temporary file first.
343 base::ScopedTempDir temp_dir; 343 base::ScopedTempDir temp_dir;
344 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 344 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
345 base::FilePath file_name = 345 base::FilePath file_name =
346 temp_dir.path().AppendASCII("TestDOMStorageDatabase.db"); 346 temp_dir.path().AppendASCII("TestDOMStorageDatabase.db");
347 347
348 const char kData[] = "I am not a database."; 348 const char kData[] = "I am not a database.";
349 file_util::WriteFile(file_name, kData, strlen(kData)); 349 base::WriteFile(file_name, kData, strlen(kData));
350 350
351 { 351 {
352 sql::ScopedErrorIgnorer ignore_errors; 352 sql::ScopedErrorIgnorer ignore_errors;
353 ignore_errors.IgnoreError(SQLITE_IOERR_SHORT_READ); 353 ignore_errors.IgnoreError(SQLITE_IOERR_SHORT_READ);
354 354
355 // Try and open the file. As it's not a database, we should end up deleting 355 // Try and open the file. As it's not a database, we should end up deleting
356 // it and creating a new, valid file, so everything should actually 356 // it and creating a new, valid file, so everything should actually
357 // succeed. 357 // succeed.
358 DOMStorageDatabase db(file_name); 358 DOMStorageDatabase db(file_name);
359 DOMStorageValuesMap values; 359 DOMStorageValuesMap values;
(...skipping 26 matching lines...) Expand all
386 EXPECT_EQ(0u, values.size()); 386 EXPECT_EQ(0u, values.size());
387 EXPECT_FALSE(db.IsOpen()); 387 EXPECT_FALSE(db.IsOpen());
388 388
389 EXPECT_TRUE(base::PathExists(temp_dir.path())); 389 EXPECT_TRUE(base::PathExists(temp_dir.path()));
390 390
391 ASSERT_TRUE(ignore_errors.CheckIgnoredErrors()); 391 ASSERT_TRUE(ignore_errors.CheckIgnoredErrors());
392 } 392 }
393 } 393 }
394 394
395 } // namespace content 395 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/dump_accessibility_tree_browsertest.cc ('k') | content/browser/download/base_file_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698