| OLD | NEW |
| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 class TestCopyOrMoveFileValidatorFactory | 173 class TestCopyOrMoveFileValidatorFactory |
| 174 : public CopyOrMoveFileValidatorFactory { | 174 : public CopyOrMoveFileValidatorFactory { |
| 175 public: | 175 public: |
| 176 // A factory that creates validators that accept everything or nothing. | 176 // A factory that creates validators that accept everything or nothing. |
| 177 TestCopyOrMoveFileValidatorFactory(bool all_valid) : all_valid_(all_valid) {} | 177 TestCopyOrMoveFileValidatorFactory(bool all_valid) : all_valid_(all_valid) {} |
| 178 virtual ~TestCopyOrMoveFileValidatorFactory() {} | 178 virtual ~TestCopyOrMoveFileValidatorFactory() {} |
| 179 | 179 |
| 180 virtual CopyOrMoveFileValidator* CreateCopyOrMoveFileValidator( | 180 virtual CopyOrMoveFileValidator* CreateCopyOrMoveFileValidator( |
| 181 const base::FilePath& /*virtual_path*/, |
| 181 const base::FilePath& /*platform_path*/) { | 182 const base::FilePath& /*platform_path*/) { |
| 182 return new TestCopyOrMoveFileValidator(all_valid_); | 183 return new TestCopyOrMoveFileValidator(all_valid_); |
| 183 } | 184 } |
| 184 | 185 |
| 185 private: | 186 private: |
| 186 class TestCopyOrMoveFileValidator : public CopyOrMoveFileValidator { | 187 class TestCopyOrMoveFileValidator : public CopyOrMoveFileValidator { |
| 187 public: | 188 public: |
| 188 TestCopyOrMoveFileValidator(bool all_valid) | 189 TestCopyOrMoveFileValidator(bool all_valid) |
| 189 : result_(all_valid ? base::PLATFORM_FILE_OK | 190 : result_(all_valid ? base::PLATFORM_FILE_OK |
| 190 : base::PLATFORM_FILE_ERROR_SECURITY) { | 191 : base::PLATFORM_FILE_ERROR_SECURITY) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 269 |
| 269 scoped_ptr<CopyOrMoveFileValidatorFactory> accept_factory( | 270 scoped_ptr<CopyOrMoveFileValidatorFactory> accept_factory( |
| 270 new TestCopyOrMoveFileValidatorFactory(true /*accept_all*/)); | 271 new TestCopyOrMoveFileValidatorFactory(true /*accept_all*/)); |
| 271 helper.SetMediaCopyOrMoveFileValidatorFactory(accept_factory.Pass()); | 272 helper.SetMediaCopyOrMoveFileValidatorFactory(accept_factory.Pass()); |
| 272 | 273 |
| 273 helper.CopyTest(base::PLATFORM_FILE_ERROR_SECURITY); | 274 helper.CopyTest(base::PLATFORM_FILE_ERROR_SECURITY); |
| 274 helper.MoveTest(base::PLATFORM_FILE_ERROR_SECURITY); | 275 helper.MoveTest(base::PLATFORM_FILE_ERROR_SECURITY); |
| 275 } | 276 } |
| 276 | 277 |
| 277 } // namespace fileapi | 278 } // namespace fileapi |
| OLD | NEW |