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

Side by Side Diff: chrome/browser/extensions/api/image_writer_private/write_from_file_operation_unittest.cc

Issue 61643015: Adds imageWriterPrivate support for Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes test cleanup ordering for Chrome OS. 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 unified diff | Download patch
OLDNEW
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/test_utils.h" 6 #include "chrome/browser/extensions/api/image_writer_private/test_utils.h"
7 #include "chrome/browser/extensions/api/image_writer_private/write_from_file_ope ration.h" 7 #include "chrome/browser/extensions/api/image_writer_private/write_from_file_ope ration.h"
8 8
9 namespace extensions { 9 namespace extensions {
10 namespace image_writer { 10 namespace image_writer {
(...skipping 22 matching lines...) Expand all
33 EXPECT_CALL(manager, OnError(kDummyExtensionId, 33 EXPECT_CALL(manager, OnError(kDummyExtensionId,
34 image_writer_api::STAGE_UNKNOWN, 34 image_writer_api::STAGE_UNKNOWN,
35 0, 35 0,
36 error::kImageInvalid)).Times(1); 36 error::kImageInvalid)).Times(1);
37 37
38 op->Start(); 38 op->Start();
39 39
40 base::RunLoop().RunUntilIdle(); 40 base::RunLoop().RunUntilIdle();
41 } 41 }
42 42
43 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 43 // Runs the entire WriteFromFile operation.
44 TEST_F(ImageWriterFromFileTest, WriteFromFileEndToEnd) { 44 TEST_F(ImageWriterFromFileTest, WriteFromFileEndToEnd) {
45 MockOperationManager manager; 45 MockOperationManager manager;
46 46
47 scoped_refptr<WriteFromFileOperation> op = 47 scoped_refptr<WriteFromFileOperation> op =
48 new WriteFromFileOperation(manager.AsWeakPtr(), 48 new WriteFromFileOperation(manager.AsWeakPtr(),
49 kDummyExtensionId, 49 kDummyExtensionId,
50 test_image_path_, 50 test_image_path_,
51 test_device_path_.AsUTF8Unsafe()); 51 test_device_path_.AsUTF8Unsafe());
52 #if !defined(OS_CHROMEOS)
53 scoped_refptr<FakeImageWriterClient> client = FakeImageWriterClient::Create();
54 op->SetUtilityClientForTesting(client);
55 #endif
52 56
53 EXPECT_CALL(manager, 57 EXPECT_CALL(manager,
54 OnProgress(kDummyExtensionId, image_writer_api::STAGE_WRITE, _)) 58 OnProgress(kDummyExtensionId, image_writer_api::STAGE_WRITE, _))
55 .Times(AnyNumber()); 59 .Times(AnyNumber());
56 EXPECT_CALL(manager, 60 EXPECT_CALL(manager,
57 OnProgress(kDummyExtensionId, image_writer_api::STAGE_WRITE, 0)) 61 OnProgress(kDummyExtensionId, image_writer_api::STAGE_WRITE, 0))
58 .Times(AtLeast(1)); 62 .Times(AtLeast(1));
59 EXPECT_CALL(manager, 63 EXPECT_CALL(manager,
60 OnProgress(kDummyExtensionId, image_writer_api::STAGE_WRITE, 100)) 64 OnProgress(kDummyExtensionId, image_writer_api::STAGE_WRITE, 100))
61 .Times(AtLeast(1)); 65 .Times(AtLeast(1));
66
67 #if !defined(OS_CHROMEOS)
68 // Chrome OS doesn't verify.
62 EXPECT_CALL( 69 EXPECT_CALL(
63 manager, 70 manager,
64 OnProgress(kDummyExtensionId, image_writer_api::STAGE_VERIFYWRITE, _)) 71 OnProgress(kDummyExtensionId, image_writer_api::STAGE_VERIFYWRITE, _))
65 .Times(AnyNumber()); 72 .Times(AnyNumber());
66 EXPECT_CALL( 73 EXPECT_CALL(
67 manager, 74 manager,
68 OnProgress(kDummyExtensionId, image_writer_api::STAGE_VERIFYWRITE, 0)) 75 OnProgress(kDummyExtensionId, image_writer_api::STAGE_VERIFYWRITE, 0))
69 .Times(AtLeast(1)); 76 .Times(AtLeast(1));
70 EXPECT_CALL( 77 EXPECT_CALL(
71 manager, 78 manager,
72 OnProgress(kDummyExtensionId, image_writer_api::STAGE_VERIFYWRITE, 100)) 79 OnProgress(kDummyExtensionId, image_writer_api::STAGE_VERIFYWRITE, 100))
73 .Times(AtLeast(1)); 80 .Times(AtLeast(1));
81 #endif
82
74 EXPECT_CALL(manager, OnComplete(kDummyExtensionId)).Times(1); 83 EXPECT_CALL(manager, OnComplete(kDummyExtensionId)).Times(1);
75 EXPECT_CALL(manager, OnError(kDummyExtensionId, _, _, _)).Times(0); 84 EXPECT_CALL(manager, OnError(kDummyExtensionId, _, _, _)).Times(0);
76 85
77 op->Start(); 86 op->Start();
78 87
79 base::RunLoop().RunUntilIdle(); 88 base::RunLoop().RunUntilIdle();
80 89 #if !defined(OS_CHROMEOS)
81 EXPECT_TRUE(base::ContentsEqual(test_image_path_, test_device_path_)); 90 client->Progress(0);
91 client->Progress(50);
92 client->Progress(100);
93 client->Success();
94 base::RunLoop().RunUntilIdle();
95 client->Progress(0);
96 client->Progress(50);
97 client->Progress(100);
98 client->Success();
99 base::RunLoop().RunUntilIdle();
100 #endif
82 } 101 }
83 #endif
84 102
85 } // namespace image_writer 103 } // namespace image_writer
86 } // namespace extensions 104 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/image_writer_private/write_from_file_operation.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698