Index: chrome/browser/extensions/api/image_writer_private/operation_manager_unittest.cc |
diff --git a/chrome/browser/extensions/api/image_writer_private/operation_manager_unittest.cc b/chrome/browser/extensions/api/image_writer_private/operation_manager_unittest.cc |
index ca4c59be626eb5874f9256c78a02995dd7277433..4a5ccf70b5869b44760c52d15a1556c2cbf09e83 100644 |
--- a/chrome/browser/extensions/api/image_writer_private/operation_manager_unittest.cc |
+++ b/chrome/browser/extensions/api/image_writer_private/operation_manager_unittest.cc |
@@ -68,6 +68,12 @@ class ImageWriterOperationManagerTest |
start_error_ = error; |
} |
+ void CancelCallback(bool success, const std::string& error) { |
+ cancelled_ = true; |
+ cancel_success_ = true; |
+ cancel_error_ = error; |
+ } |
+ |
protected: |
ImageWriterOperationManagerTest() |
: started_(false), |
@@ -87,6 +93,10 @@ class ImageWriterOperationManagerTest |
bool start_success_; |
std::string start_error_; |
+ bool cancelled_; |
+ bool cancel_success_; |
+ std::string cancel_error_; |
+ |
TestingProfile test_profile_; |
FakeExtensionSystem* extension_system_; |
FakeEventRouter* event_router_; |
@@ -112,6 +122,15 @@ TEST_F(ImageWriterOperationManagerTest, WriteFromFile) { |
EXPECT_TRUE(start_success_); |
EXPECT_EQ("", start_error_); |
+ manager.CancelWrite( |
+ kDummyExtensionId, |
+ base::Bind(&ImageWriterOperationManagerTest::CancelCallback, |
+ base::Unretained(this))); |
+ |
+ EXPECT_TRUE(cancelled_); |
+ EXPECT_TRUE(cancel_success_); |
+ EXPECT_EQ("", cancel_error_); |
+ |
base::RunLoop().RunUntilIdle(); |
} |
@@ -128,6 +147,15 @@ TEST_F(ImageWriterOperationManagerTest, DestroyPartitions) { |
EXPECT_TRUE(start_success_); |
EXPECT_EQ("", start_error_); |
+ manager.CancelWrite( |
+ kDummyExtensionId, |
+ base::Bind(&ImageWriterOperationManagerTest::CancelCallback, |
+ base::Unretained(this))); |
+ |
+ EXPECT_TRUE(cancelled_); |
+ EXPECT_TRUE(cancel_success_); |
+ EXPECT_EQ("", cancel_error_); |
+ |
base::RunLoop().RunUntilIdle(); |
} |