| 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/test_utils.h" | 5 #include "chrome/browser/extensions/api/image_writer_private/test_utils.h" |
| 6 | 6 |
| 7 #if defined(OS_CHROMEOS) | 7 #if defined(OS_CHROMEOS) |
| 8 #include "chromeos/dbus/dbus_thread_manager.h" | 8 #include "chromeos/dbus/dbus_thread_manager.h" |
| 9 #include "chromeos/dbus/fake_image_burner_client.h" | 9 #include "chromeos/dbus/fake_image_burner_client.h" |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 namespace extensions { | 12 namespace extensions { |
| 13 namespace image_writer { | 13 namespace image_writer { |
| 14 | 14 |
| 15 #if defined(OS_CHROMEOS) | 15 #if defined(OS_CHROMEOS) |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 class ImageWriterFakeImageBurnerClient | 18 class ImageWriterFakeImageBurnerClient |
| 19 : public chromeos::FakeImageBurnerClient { | 19 : public chromeos::FakeImageBurnerClient { |
| 20 public: | 20 public: |
| 21 ImageWriterFakeImageBurnerClient() {} | 21 ImageWriterFakeImageBurnerClient() {} |
| 22 virtual ~ImageWriterFakeImageBurnerClient() {} | 22 virtual ~ImageWriterFakeImageBurnerClient() {} |
| 23 | 23 |
| 24 virtual void SetEventHandlers( | 24 virtual void SetEventHandlers( |
| 25 const BurnFinishedHandler& burn_finished_handler, | 25 const BurnFinishedHandler& burn_finished_handler, |
| 26 const BurnProgressUpdateHandler& burn_progress_update_handler) OVERRIDE { | 26 const BurnProgressUpdateHandler& burn_progress_update_handler) override { |
| 27 burn_finished_handler_ = burn_finished_handler; | 27 burn_finished_handler_ = burn_finished_handler; |
| 28 burn_progress_update_handler_ = burn_progress_update_handler; | 28 burn_progress_update_handler_ = burn_progress_update_handler; |
| 29 } | 29 } |
| 30 | 30 |
| 31 virtual void BurnImage(const std::string& from_path, | 31 virtual void BurnImage(const std::string& from_path, |
| 32 const std::string& to_path, | 32 const std::string& to_path, |
| 33 const ErrorCallback& error_callback) OVERRIDE { | 33 const ErrorCallback& error_callback) override { |
| 34 base::MessageLoop::current()->PostTask(FROM_HERE, | 34 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 35 base::Bind(burn_progress_update_handler_, to_path, 0, 100)); | 35 base::Bind(burn_progress_update_handler_, to_path, 0, 100)); |
| 36 base::MessageLoop::current()->PostTask(FROM_HERE, | 36 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 37 base::Bind(burn_progress_update_handler_, to_path, 50, 100)); | 37 base::Bind(burn_progress_update_handler_, to_path, 50, 100)); |
| 38 base::MessageLoop::current()->PostTask(FROM_HERE, | 38 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 39 base::Bind(burn_progress_update_handler_, to_path, 100, 100)); | 39 base::Bind(burn_progress_update_handler_, to_path, 100, 100)); |
| 40 base::MessageLoop::current()->PostTask(FROM_HERE, | 40 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 41 base::Bind(burn_finished_handler_, to_path, true, "")); | 41 base::Bind(burn_finished_handler_, to_path, true, "")); |
| 42 } | 42 } |
| 43 | 43 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 test_utils_.SetUp(); | 263 test_utils_.SetUp(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void ImageWriterUnitTestBase::TearDown() { | 266 void ImageWriterUnitTestBase::TearDown() { |
| 267 testing::Test::TearDown(); | 267 testing::Test::TearDown(); |
| 268 test_utils_.TearDown(); | 268 test_utils_.TearDown(); |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace image_writer | 271 } // namespace image_writer |
| 272 } // namespace extensions | 272 } // namespace extensions |
| OLD | NEW |