Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / extensions / api / image_writer_private / destroy_partitions_operation_unittest.cc
blob9363a1ad7bc0c4813ed10b3d8d44dc0003077b54
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/run_loop.h"
6 #include "chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.h"
7 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h"
8 #include "chrome/browser/extensions/api/image_writer_private/test_utils.h"
9 #include "chrome/test/base/testing_profile.h"
11 namespace extensions {
12 namespace image_writer {
13 namespace {
15 using testing::_;
16 using testing::AnyNumber;
17 using testing::AtLeast;
19 class ImageWriterDestroyPartitionsOperationTest
20 : public ImageWriterUnitTestBase {};
22 TEST_F(ImageWriterDestroyPartitionsOperationTest, EndToEnd) {
23 TestingProfile profile;
24 MockOperationManager manager(&profile);
26 scoped_refptr<DestroyPartitionsOperation> operation(
27 new DestroyPartitionsOperation(
28 manager.AsWeakPtr(),
29 kDummyExtensionId,
30 test_utils_.GetDevicePath().AsUTF8Unsafe()));
32 EXPECT_CALL(
33 manager,
34 OnProgress(kDummyExtensionId, image_writer_api::STAGE_VERIFYWRITE, _))
35 .Times(AnyNumber());
36 EXPECT_CALL(manager, OnProgress(kDummyExtensionId,
37 image_writer_api::STAGE_WRITE,
38 _)).Times(AnyNumber());
39 EXPECT_CALL(manager,
40 OnProgress(kDummyExtensionId, image_writer_api::STAGE_WRITE, 0))
41 .Times(AtLeast(1));
42 EXPECT_CALL(manager,
43 OnProgress(kDummyExtensionId, image_writer_api::STAGE_WRITE, 100))
44 .Times(AtLeast(1));
45 EXPECT_CALL(manager, OnComplete(kDummyExtensionId)).Times(1);
46 EXPECT_CALL(manager, OnError(kDummyExtensionId, _, _, _)).Times(0);
48 operation->Start();
50 base::RunLoop().RunUntilIdle();
52 #if !defined(OS_CHROMEOS)
53 test_utils_.GetUtilityClient()->Progress(0);
54 test_utils_.GetUtilityClient()->Progress(50);
55 test_utils_.GetUtilityClient()->Progress(100);
56 test_utils_.GetUtilityClient()->Success();
58 base::RunLoop().RunUntilIdle();
59 #endif
62 } // namespace
63 } // namespace image_writer
64 } // namespace extensions