Chromium Code Reviews| Index: webkit/browser/fileapi/copy_or_move_file_validator_unittest.cc |
| diff --git a/webkit/browser/fileapi/copy_or_move_file_validator_unittest.cc b/webkit/browser/fileapi/copy_or_move_file_validator_unittest.cc |
| index 1190f7aaa31d5892c6eb6eea59d7f1eb9426ff88..e2003027d1d486798662b57ac78a54422ddc9ec5 100644 |
| --- a/webkit/browser/fileapi/copy_or_move_file_validator_unittest.cc |
| +++ b/webkit/browser/fileapi/copy_or_move_file_validator_unittest.cc |
| @@ -183,11 +183,18 @@ class CopyOrMoveFileValidatorTestHelper { |
| class TestCopyOrMoveFileValidatorFactory |
| : public CopyOrMoveFileValidatorFactory { |
| public: |
| + enum Validity { |
| + ALL_VALID, |
|
vandebo (ex-Chrome)
2013/07/31 18:45:06
How about VALID, PRE_WRITE_INVALID, and POST_WRITE
Greg Billock
2013/07/31 19:01:54
Went with just "INVALID" for the second.
|
| + ALL_INVALID, |
| + WRITE_VALID_POST_WRITE_INVALID |
| + }; |
| + |
| // A factory that creates validators that accept everything or nothing. |
| - explicit TestCopyOrMoveFileValidatorFactory(bool all_valid, |
| - bool all_valid_write) |
| - : all_valid_(all_valid), |
| - all_valid_write_(all_valid_write) {} |
| + // TODO(gbillock): switch args to enum or something |
| + explicit TestCopyOrMoveFileValidatorFactory(Validity validity) |
| + : all_valid_(validity == ALL_VALID || |
| + validity == WRITE_VALID_POST_WRITE_INVALID), |
| + all_valid_write_(validity == ALL_VALID) {} |
| virtual ~TestCopyOrMoveFileValidatorFactory() {} |
| virtual CopyOrMoveFileValidator* CreateCopyOrMoveFileValidator( |
| @@ -266,7 +273,8 @@ TEST(CopyOrMoveFileValidatorTest, AcceptAll) { |
| kWithValidatorType); |
| helper.SetUp(); |
| scoped_ptr<CopyOrMoveFileValidatorFactory> factory( |
| - new TestCopyOrMoveFileValidatorFactory(true, true /*accept_all*/)); |
| + new TestCopyOrMoveFileValidatorFactory( |
| + TestCopyOrMoveFileValidatorFactory::ALL_VALID)); |
| helper.SetMediaCopyOrMoveFileValidatorFactory(factory.Pass()); |
| helper.CopyTest(base::PLATFORM_FILE_OK); |
| @@ -279,7 +287,8 @@ TEST(CopyOrMoveFileValidatorTest, AcceptNone) { |
| kWithValidatorType); |
| helper.SetUp(); |
| scoped_ptr<CopyOrMoveFileValidatorFactory> factory( |
| - new TestCopyOrMoveFileValidatorFactory(false, false /*accept_all*/)); |
| + new TestCopyOrMoveFileValidatorFactory( |
| + TestCopyOrMoveFileValidatorFactory::ALL_INVALID)); |
| helper.SetMediaCopyOrMoveFileValidatorFactory(factory.Pass()); |
| helper.CopyTest(base::PLATFORM_FILE_ERROR_SECURITY); |
| @@ -293,11 +302,13 @@ TEST(CopyOrMoveFileValidatorTest, OverrideValidator) { |
| kWithValidatorType); |
| helper.SetUp(); |
| scoped_ptr<CopyOrMoveFileValidatorFactory> reject_factory( |
| - new TestCopyOrMoveFileValidatorFactory(false, false /*accept_all*/)); |
| + new TestCopyOrMoveFileValidatorFactory( |
| + TestCopyOrMoveFileValidatorFactory::ALL_INVALID)); |
| helper.SetMediaCopyOrMoveFileValidatorFactory(reject_factory.Pass()); |
| scoped_ptr<CopyOrMoveFileValidatorFactory> accept_factory( |
| - new TestCopyOrMoveFileValidatorFactory(true, true /*accept_all*/)); |
| + new TestCopyOrMoveFileValidatorFactory( |
| + TestCopyOrMoveFileValidatorFactory::ALL_VALID)); |
| helper.SetMediaCopyOrMoveFileValidatorFactory(accept_factory.Pass()); |
| helper.CopyTest(base::PLATFORM_FILE_ERROR_SECURITY); |
| @@ -310,8 +321,8 @@ TEST(CopyOrMoveFileValidatorTest, RejectPostWrite) { |
| kWithValidatorType); |
| helper.SetUp(); |
| scoped_ptr<CopyOrMoveFileValidatorFactory> factory( |
| - // accept pre-copy, reject post-copy |
| - new TestCopyOrMoveFileValidatorFactory(true, false)); |
| + new TestCopyOrMoveFileValidatorFactory( |
| + TestCopyOrMoveFileValidatorFactory::WRITE_VALID_POST_WRITE_INVALID)); |
| helper.SetMediaCopyOrMoveFileValidatorFactory(factory.Pass()); |
| helper.CopyTest(base::PLATFORM_FILE_ERROR_SECURITY); |