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

Side by Side Diff: content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc

Issue 623933003: Replacing the OVERRIDE with override and FINAL with final in content/browser/fileapi (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 <map> 5 #include <map>
6 #include <queue> 6 #include <queue>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 50
51 class TestValidatorFactory : public storage::CopyOrMoveFileValidatorFactory { 51 class TestValidatorFactory : public storage::CopyOrMoveFileValidatorFactory {
52 public: 52 public:
53 // A factory that creates validators that accept everything or nothing. 53 // A factory that creates validators that accept everything or nothing.
54 TestValidatorFactory() {} 54 TestValidatorFactory() {}
55 virtual ~TestValidatorFactory() {} 55 virtual ~TestValidatorFactory() {}
56 56
57 virtual storage::CopyOrMoveFileValidator* CreateCopyOrMoveFileValidator( 57 virtual storage::CopyOrMoveFileValidator* CreateCopyOrMoveFileValidator(
58 const FileSystemURL& /*src_url*/, 58 const FileSystemURL& /*src_url*/,
59 const base::FilePath& /*platform_path*/) OVERRIDE { 59 const base::FilePath& /*platform_path*/) override {
60 // Move arg management to TestValidator? 60 // Move arg management to TestValidator?
61 return new TestValidator(true, true, std::string("2")); 61 return new TestValidator(true, true, std::string("2"));
62 } 62 }
63 63
64 private: 64 private:
65 class TestValidator : public storage::CopyOrMoveFileValidator { 65 class TestValidator : public storage::CopyOrMoveFileValidator {
66 public: 66 public:
67 explicit TestValidator(bool pre_copy_valid, 67 explicit TestValidator(bool pre_copy_valid,
68 bool post_copy_valid, 68 bool post_copy_valid,
69 const std::string& reject_string) 69 const std::string& reject_string)
70 : result_(pre_copy_valid ? base::File::FILE_OK : 70 : result_(pre_copy_valid ? base::File::FILE_OK :
71 base::File::FILE_ERROR_SECURITY), 71 base::File::FILE_ERROR_SECURITY),
72 write_result_(post_copy_valid ? base::File::FILE_OK : 72 write_result_(post_copy_valid ? base::File::FILE_OK :
73 base::File::FILE_ERROR_SECURITY), 73 base::File::FILE_ERROR_SECURITY),
74 reject_string_(reject_string) { 74 reject_string_(reject_string) {
75 } 75 }
76 virtual ~TestValidator() {} 76 virtual ~TestValidator() {}
77 77
78 virtual void StartPreWriteValidation( 78 virtual void StartPreWriteValidation(
79 const ResultCallback& result_callback) OVERRIDE { 79 const ResultCallback& result_callback) override {
80 // Post the result since a real validator must do work asynchronously. 80 // Post the result since a real validator must do work asynchronously.
81 base::MessageLoop::current()->PostTask( 81 base::MessageLoop::current()->PostTask(
82 FROM_HERE, base::Bind(result_callback, result_)); 82 FROM_HERE, base::Bind(result_callback, result_));
83 } 83 }
84 84
85 virtual void StartPostWriteValidation( 85 virtual void StartPostWriteValidation(
86 const base::FilePath& dest_platform_path, 86 const base::FilePath& dest_platform_path,
87 const ResultCallback& result_callback) OVERRIDE { 87 const ResultCallback& result_callback) override {
88 base::File::Error result = write_result_; 88 base::File::Error result = write_result_;
89 std::string unsafe = dest_platform_path.BaseName().AsUTF8Unsafe(); 89 std::string unsafe = dest_platform_path.BaseName().AsUTF8Unsafe();
90 if (unsafe.find(reject_string_) != std::string::npos) { 90 if (unsafe.find(reject_string_) != std::string::npos) {
91 result = base::File::FILE_ERROR_SECURITY; 91 result = base::File::FILE_ERROR_SECURITY;
92 } 92 }
93 // Post the result since a real validator must do work asynchronously. 93 // Post the result since a real validator must do work asynchronously.
94 base::MessageLoop::current()->PostTask( 94 base::MessageLoop::current()->PostTask(
95 FROM_HERE, base::Bind(result_callback, result)); 95 FROM_HERE, base::Bind(result_callback, result));
96 } 96 }
97 97
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 860
861 base::File::Error error = base::File::FILE_ERROR_FAILED; 861 base::File::Error error = base::File::FILE_ERROR_FAILED;
862 base::RunLoop run_loop; 862 base::RunLoop run_loop;
863 helper.Run(base::Bind(&AssignAndQuit, &run_loop, &error)); 863 helper.Run(base::Bind(&AssignAndQuit, &run_loop, &error));
864 run_loop.Run(); 864 run_loop.Run();
865 865
866 EXPECT_EQ(base::File::FILE_ERROR_ABORT, error); 866 EXPECT_EQ(base::File::FILE_ERROR_ABORT, error);
867 } 867 }
868 868
869 } // namespace content 869 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/copy_or_move_file_validator_unittest.cc ('k') | content/browser/fileapi/file_system_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698