OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" | 5 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" |
6 #include "chrome/browser/extensions/api/image_writer_private/operation.h" | 6 #include "chrome/browser/extensions/api/image_writer_private/operation.h" |
7 #include "chrome/browser/extensions/api/image_writer_private/test_utils.h" | 7 #include "chrome/browser/extensions/api/image_writer_private/test_utils.h" |
8 | 8 |
9 namespace extensions { | 9 namespace extensions { |
10 namespace image_writer { | 10 namespace image_writer { |
11 namespace { | |
12 | 11 |
13 class ImageWriterOperationTest : public ImageWriterUnitTestBase { | 12 class ImageWriterOperationTest : public ImageWriterUnitTestBase { |
14 }; | 13 }; |
15 | 14 |
16 class DummyOperation : public Operation { | 15 class DummyOperation : public Operation { |
17 public: | 16 public: |
18 DummyOperation(base::WeakPtr<OperationManager> manager, | 17 DummyOperation(base::WeakPtr<OperationManager> manager, |
19 const ExtensionId& extension_id, | 18 const ExtensionId& extension_id, |
20 const std::string& storage_unit_id) | 19 const std::string& storage_unit_id) |
21 : Operation(manager, extension_id, storage_unit_id) {}; | 20 : Operation(manager, extension_id, storage_unit_id) {}; |
22 virtual void Start() OVERRIDE {}; | 21 virtual void Start() OVERRIDE {}; |
23 private: | 22 private: |
24 virtual ~DummyOperation() {}; | 23 virtual ~DummyOperation() {}; |
25 }; | 24 }; |
26 | 25 |
27 TEST_F(ImageWriterOperationTest, Create) { | 26 TEST_F(ImageWriterOperationTest, Create) { |
28 MockOperationManager manager; | 27 MockOperationManager manager; |
29 scoped_refptr<Operation> op( | 28 scoped_refptr<Operation> op(new DummyOperation(manager.AsWeakPtr(), |
30 new DummyOperation(manager.AsWeakPtr(), | 29 kDummyExtensionId, |
31 kDummyExtensionId, | 30 test_device_.AsUTF8Unsafe())); |
32 test_device_path_.AsUTF8Unsafe())); | |
33 | 31 |
34 EXPECT_EQ(0, op->GetProgress()); | 32 EXPECT_EQ(0, op->GetProgress()); |
35 EXPECT_EQ(image_writer_api::STAGE_UNKNOWN, op->GetStage()); | 33 EXPECT_EQ(image_writer_api::STAGE_UNKNOWN, op->GetStage()); |
36 } | 34 } |
37 | 35 |
38 } // namespace | |
39 } // namespace image_writer | 36 } // namespace image_writer |
40 } // namespace extensions | 37 } // namespace extensions |
OLD | NEW |