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

Side by Side Diff: webkit/browser/fileapi/copy_or_move_file_validator_unittest.cc

Issue 18565002: [FileSystem] Add another copy-or-move validation hook for post-write. (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 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } 200 }
201 virtual ~TestCopyOrMoveFileValidator() {} 201 virtual ~TestCopyOrMoveFileValidator() {}
202 202
203 virtual void StartValidation( 203 virtual void StartValidation(
204 const ResultCallback& result_callback) OVERRIDE { 204 const ResultCallback& result_callback) OVERRIDE {
205 // Post the result since a real validator must do work asynchronously. 205 // Post the result since a real validator must do work asynchronously.
206 base::MessageLoop::current()->PostTask( 206 base::MessageLoop::current()->PostTask(
207 FROM_HERE, base::Bind(result_callback, result_)); 207 FROM_HERE, base::Bind(result_callback, result_));
208 } 208 }
209 209
210 virtual void StartPostWriteValidation(
211 const base::FilePath& dest_platform_path,
212 const ResultCallback& result_callback) OVERRIDE {
213 // Post the result since a real validator must do work asynchronously.
214 base::MessageLoop::current()->PostTask(
215 FROM_HERE, base::Bind(result_callback, result_));
vandebo (ex-Chrome) 2013/07/02 18:43:05 The test validator should control pre/post validat
Greg Billock 2013/07/02 19:17:39 Done.
216 }
217
210 private: 218 private:
211 base::PlatformFileError result_; 219 base::PlatformFileError result_;
212 220
213 DISALLOW_COPY_AND_ASSIGN(TestCopyOrMoveFileValidator); 221 DISALLOW_COPY_AND_ASSIGN(TestCopyOrMoveFileValidator);
214 }; 222 };
215 223
216 bool all_valid_; 224 bool all_valid_;
217 225
218 DISALLOW_COPY_AND_ASSIGN(TestCopyOrMoveFileValidatorFactory); 226 DISALLOW_COPY_AND_ASSIGN(TestCopyOrMoveFileValidatorFactory);
219 }; 227 };
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 288
281 scoped_ptr<CopyOrMoveFileValidatorFactory> accept_factory( 289 scoped_ptr<CopyOrMoveFileValidatorFactory> accept_factory(
282 new TestCopyOrMoveFileValidatorFactory(true /*accept_all*/)); 290 new TestCopyOrMoveFileValidatorFactory(true /*accept_all*/));
283 helper.SetMediaCopyOrMoveFileValidatorFactory(accept_factory.Pass()); 291 helper.SetMediaCopyOrMoveFileValidatorFactory(accept_factory.Pass());
284 292
285 helper.CopyTest(base::PLATFORM_FILE_ERROR_SECURITY); 293 helper.CopyTest(base::PLATFORM_FILE_ERROR_SECURITY);
286 helper.MoveTest(base::PLATFORM_FILE_ERROR_SECURITY); 294 helper.MoveTest(base::PLATFORM_FILE_ERROR_SECURITY);
287 } 295 }
288 296
289 } // namespace fileapi 297 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698