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

Unified Diff: chrome/browser/extensions/api/image_writer_private/write_from_file_operation_unittest.cc

Issue 149313003: Significantly cleans up the ImageWriter Operation class and subclasses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes cross-compilation and test issues. Created 6 years, 10 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: chrome/browser/extensions/api/image_writer_private/write_from_file_operation_unittest.cc
diff --git a/chrome/browser/extensions/api/image_writer_private/write_from_file_operation_unittest.cc b/chrome/browser/extensions/api/image_writer_private/write_from_file_operation_unittest.cc
index 223d731e6fddee31cce3b21145d897732ba6f240..1cab40b619728286d8bca543eb77e5a108e14e0b 100644
--- a/chrome/browser/extensions/api/image_writer_private/write_from_file_operation_unittest.cc
+++ b/chrome/browser/extensions/api/image_writer_private/write_from_file_operation_unittest.cc
@@ -40,5 +40,47 @@ TEST_F(ImageWriterFromFileTest, InvalidFile) {
base::RunLoop().RunUntilIdle();
}
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+TEST_F(ImageWriterFromFileTest, WriteFromFileEndToEnd) {
+ MockOperationManager manager;
+
+ scoped_refptr<WriteFromFileOperation> op =
+ new WriteFromFileOperation(manager.AsWeakPtr(),
+ kDummyExtensionId,
+ test_image_path_,
+ test_device_path_.AsUTF8Unsafe());
+
+ EXPECT_CALL(manager,
+ OnProgress(kDummyExtensionId, image_writer_api::STAGE_WRITE, _))
+ .Times(AnyNumber());
+ EXPECT_CALL(manager,
+ OnProgress(kDummyExtensionId, image_writer_api::STAGE_WRITE, 0))
+ .Times(AtLeast(1));
+ EXPECT_CALL(manager,
+ OnProgress(kDummyExtensionId, image_writer_api::STAGE_WRITE, 100))
+ .Times(AtLeast(1));
+ EXPECT_CALL(
+ manager,
+ OnProgress(kDummyExtensionId, image_writer_api::STAGE_VERIFYWRITE, _))
+ .Times(AnyNumber());
+ EXPECT_CALL(
+ manager,
+ OnProgress(kDummyExtensionId, image_writer_api::STAGE_VERIFYWRITE, 0))
+ .Times(AtLeast(1));
+ EXPECT_CALL(
+ manager,
+ OnProgress(kDummyExtensionId, image_writer_api::STAGE_VERIFYWRITE, 100))
+ .Times(AtLeast(1));
+ EXPECT_CALL(manager, OnComplete(kDummyExtensionId)).Times(1);
+ EXPECT_CALL(manager, OnError(kDummyExtensionId, _, _, _)).Times(0);
+
+ op->Start();
+
+ base::RunLoop().RunUntilIdle();
+
+ EXPECT_TRUE(base::ContentsEqual(test_image_path_, test_device_path_));
+}
+#endif
+
} // namespace image_writer
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698