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

Unified Diff: webkit/browser/fileapi/copy_or_move_file_validator_unittest.cc

Issue 21097005: Fix up some tests for copy-or-move validator and nearby. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698