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

Side by Side Diff: chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc

Issue 610223002: [SyncFS] Use nullptr instead of NULL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 file_system_.MaybeInitializeFileSystemContext(sync_context_.get())); 77 file_system_.MaybeInitializeFileSystemContext(sync_context_.get()));
78 78
79 ASSERT_EQ(File::FILE_OK, file_system_.OpenFileSystem()); 79 ASSERT_EQ(File::FILE_OK, file_system_.OpenFileSystem());
80 ASSERT_EQ(File::FILE_OK, 80 ASSERT_EQ(File::FILE_OK,
81 file_system_.CreateDirectory(URL(kParent))); 81 file_system_.CreateDirectory(URL(kParent)));
82 } 82 }
83 83
84 virtual void TearDown() OVERRIDE { 84 virtual void TearDown() OVERRIDE {
85 if (sync_context_.get()) 85 if (sync_context_.get())
86 sync_context_->ShutdownOnUIThread(); 86 sync_context_->ShutdownOnUIThread();
87 sync_context_ = NULL; 87 sync_context_ = nullptr;
88 88
89 file_system_.TearDown(); 89 file_system_.TearDown();
90 RevokeSyncableFileSystem(); 90 RevokeSyncableFileSystem();
91 } 91 }
92 92
93 FileSystemURL URL(const std::string& path) { 93 FileSystemURL URL(const std::string& path) {
94 return file_system_.URL(path); 94 return file_system_.URL(path);
95 } 95 }
96 96
97 LocalFileSyncStatus* sync_status() { 97 LocalFileSyncStatus* sync_status() {
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 file_system_.operation_runner()->Truncate( 339 file_system_.operation_runner()->Truncate(
340 URL(kFile), 1, 340 URL(kFile), 1,
341 ExpectStatus(FROM_HERE, File::FILE_ERROR_ABORT)); 341 ExpectStatus(FROM_HERE, File::FILE_ERROR_ABORT));
342 base::MessageLoop::current()->RunUntilIdle(); 342 base::MessageLoop::current()->RunUntilIdle();
343 EXPECT_EQ(0, callback_count_); 343 EXPECT_EQ(0, callback_count_);
344 344
345 ResetCallbackStatus(); 345 ResetCallbackStatus();
346 346
347 // This shouldn't crash nor leak memory. 347 // This shouldn't crash nor leak memory.
348 sync_context_->ShutdownOnUIThread(); 348 sync_context_->ShutdownOnUIThread();
349 sync_context_ = NULL; 349 sync_context_ = nullptr;
350 base::MessageLoop::current()->RunUntilIdle(); 350 base::MessageLoop::current()->RunUntilIdle();
351 EXPECT_EQ(2, callback_count_); 351 EXPECT_EQ(2, callback_count_);
352 } 352 }
353 353
354 // Test if CopyInForeignFile runs cooperatively with other Sync operations. 354 // Test if CopyInForeignFile runs cooperatively with other Sync operations.
355 TEST_F(SyncableFileOperationRunnerTest, CopyInForeignFile) { 355 TEST_F(SyncableFileOperationRunnerTest, CopyInForeignFile) {
356 const std::string kTestData("test data"); 356 const std::string kTestData("test data");
357 357
358 base::FilePath temp_path; 358 base::FilePath temp_path;
359 ASSERT_TRUE(CreateTempFile(&temp_path)); 359 ASSERT_TRUE(CreateTempFile(&temp_path));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 storage::FileSystemOperationRunner::OperationID id = 402 storage::FileSystemOperationRunner::OperationID id =
403 file_system_.operation_runner()->Truncate( 403 file_system_.operation_runner()->Truncate(
404 URL(kFile), 10, ExpectStatus(FROM_HERE, File::FILE_OK)); 404 URL(kFile), 10, ExpectStatus(FROM_HERE, File::FILE_OK));
405 file_system_.operation_runner()->Cancel( 405 file_system_.operation_runner()->Cancel(
406 id, ExpectStatus(FROM_HERE, File::FILE_ERROR_INVALID_OPERATION)); 406 id, ExpectStatus(FROM_HERE, File::FILE_ERROR_INVALID_OPERATION));
407 base::MessageLoop::current()->RunUntilIdle(); 407 base::MessageLoop::current()->RunUntilIdle();
408 EXPECT_EQ(2, callback_count_); 408 EXPECT_EQ(2, callback_count_);
409 } 409 }
410 410
411 } // namespace sync_file_system 411 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698