| 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 #include <string.h> | 7 #include <string.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 } | 153 } |
| 154 ImageWriterTestUtils::~ImageWriterTestUtils() { | 154 ImageWriterTestUtils::~ImageWriterTestUtils() { |
| 155 } | 155 } |
| 156 | 156 |
| 157 void ImageWriterTestUtils::SetUp() { | 157 void ImageWriterTestUtils::SetUp() { |
| 158 SetUp(false); | 158 SetUp(false); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void ImageWriterTestUtils::SetUp(bool is_browser_test) { | 161 void ImageWriterTestUtils::SetUp(bool is_browser_test) { |
| 162 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 162 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 163 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), | 163 ASSERT_TRUE( |
| 164 &test_image_path_)); | 164 base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &test_image_path_)); |
| 165 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), | 165 ASSERT_TRUE( |
| 166 &test_device_path_)); | 166 base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &test_device_path_)); |
| 167 | 167 |
| 168 ASSERT_TRUE(FillFile(test_image_path_, kImagePattern, kTestFileSize)); | 168 ASSERT_TRUE(FillFile(test_image_path_, kImagePattern, kTestFileSize)); |
| 169 ASSERT_TRUE(FillFile(test_device_path_, kDevicePattern, kTestFileSize)); | 169 ASSERT_TRUE(FillFile(test_device_path_, kDevicePattern, kTestFileSize)); |
| 170 | 170 |
| 171 #if defined(OS_CHROMEOS) | 171 #if defined(OS_CHROMEOS) |
| 172 if (!chromeos::DBusThreadManager::IsInitialized()) { | 172 if (!chromeos::DBusThreadManager::IsInitialized()) { |
| 173 std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter = | 173 std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter = |
| 174 chromeos::DBusThreadManager::GetSetterForTesting(); | 174 chromeos::DBusThreadManager::GetSetterForTesting(); |
| 175 std::unique_ptr<chromeos::ImageBurnerClient> image_burner_fake( | 175 std::unique_ptr<chromeos::ImageBurnerClient> image_burner_fake( |
| 176 new ImageWriterFakeImageBurnerClient()); | 176 new ImageWriterFakeImageBurnerClient()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 chromeos::DBusThreadManager::Shutdown(); | 210 chromeos::DBusThreadManager::Shutdown(); |
| 211 } | 211 } |
| 212 chromeos::disks::DiskMountManager::Shutdown(); | 212 chromeos::disks::DiskMountManager::Shutdown(); |
| 213 #else | 213 #else |
| 214 image_writer::Operation::SetUtilityClientForTesting(NULL); | 214 image_writer::Operation::SetUtilityClientForTesting(NULL); |
| 215 client_->Shutdown(); | 215 client_->Shutdown(); |
| 216 #endif | 216 #endif |
| 217 } | 217 } |
| 218 | 218 |
| 219 const base::FilePath& ImageWriterTestUtils::GetTempDir() { | 219 const base::FilePath& ImageWriterTestUtils::GetTempDir() { |
| 220 return temp_dir_.path(); | 220 return temp_dir_.GetPath(); |
| 221 } | 221 } |
| 222 | 222 |
| 223 const base::FilePath& ImageWriterTestUtils::GetImagePath() { | 223 const base::FilePath& ImageWriterTestUtils::GetImagePath() { |
| 224 return test_image_path_; | 224 return test_image_path_; |
| 225 } | 225 } |
| 226 | 226 |
| 227 const base::FilePath& ImageWriterTestUtils::GetDevicePath() { | 227 const base::FilePath& ImageWriterTestUtils::GetDevicePath() { |
| 228 return test_device_path_; | 228 return test_device_path_; |
| 229 } | 229 } |
| 230 | 230 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 test_utils_.SetUp(); | 273 test_utils_.SetUp(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 void ImageWriterUnitTestBase::TearDown() { | 276 void ImageWriterUnitTestBase::TearDown() { |
| 277 testing::Test::TearDown(); | 277 testing::Test::TearDown(); |
| 278 test_utils_.TearDown(); | 278 test_utils_.TearDown(); |
| 279 } | 279 } |
| 280 | 280 |
| 281 } // namespace image_writer | 281 } // namespace image_writer |
| 282 } // namespace extensions | 282 } // namespace extensions |
| OLD | NEW |