| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 private: | 55 private: |
| 56 base::MessageLoop message_loop_; | 56 base::MessageLoop message_loop_; |
| 57 base::ScopedTempDir temp_dir_; | 57 base::ScopedTempDir temp_dir_; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 class MockHandler : public ImageWriterHandler { | 60 class MockHandler : public ImageWriterHandler { |
| 61 public: | 61 public: |
| 62 MOCK_METHOD1(SendProgress, void(int64_t)); | 62 MOCK_METHOD1(SendProgress, void(int64_t)); |
| 63 MOCK_METHOD1(SendFailed, void(const std::string& message)); | 63 MOCK_METHOD1(SendFailed, void(const std::string& message)); |
| 64 MOCK_METHOD0(SendSucceeded, void()); | 64 MOCK_METHOD0(SendSucceeded, void()); |
| 65 MOCK_METHOD1(OnMessageReceived, bool(const IPC::Message& message)); | |
| 66 }; | 65 }; |
| 67 | 66 |
| 68 // This Mock has the additional feature that it will start verification when | 67 // This Mock has the additional feature that it will start verification when |
| 69 // the write completes. | 68 // the write completes. |
| 70 class VerifyingHandler : public MockHandler { | 69 class VerifyingHandler : public MockHandler { |
| 71 public: | 70 public: |
| 72 VerifyingHandler() : image_writer_(NULL), verified_(false) {} | 71 VerifyingHandler() : image_writer_(NULL), verified_(false) {} |
| 73 | 72 |
| 74 void SendSucceeded() override { | 73 void SendSucceeded() override { |
| 75 MockHandler::SendSucceeded(); | 74 MockHandler::SendSucceeded(); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 EXPECT_CALL(mock_handler, SendFailed(_)).Times(0); | 224 EXPECT_CALL(mock_handler, SendFailed(_)).Times(0); |
| 226 | 225 |
| 227 FillDefault(image_path_); | 226 FillDefault(image_path_); |
| 228 | 227 |
| 229 image_writer.Write(); | 228 image_writer.Write(); |
| 230 | 229 |
| 231 base::RunLoop().RunUntilIdle(); | 230 base::RunLoop().RunUntilIdle(); |
| 232 } | 231 } |
| 233 | 232 |
| 234 } // namespace image_writer | 233 } // namespace image_writer |
| OLD | NEW |