| 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
| 7 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 7 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
| 8 #include "chrome/browser/extensions/api/image_writer_private/operation.h" | 8 #include "chrome/browser/extensions/api/image_writer_private/operation.h" |
| 9 #include "chrome/browser/extensions/api/image_writer_private/removable_storage_p
rovider.h" | 9 #include "chrome/browser/extensions/api/image_writer_private/removable_storage_p
rovider.h" |
| 10 #include "chrome/browser/extensions/api/image_writer_private/test_utils.h" | 10 #include "chrome/browser/extensions/api/image_writer_private/test_utils.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 void TearDownInProcessBrowserTestFixture() override { | 63 void TearDownInProcessBrowserTestFixture() override { |
| 64 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); | 64 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); |
| 65 test_utils_.TearDown(); | 65 test_utils_.TearDown(); |
| 66 RemovableStorageProvider::ClearDeviceListForTesting(); | 66 RemovableStorageProvider::ClearDeviceListForTesting(); |
| 67 FileSystemChooseEntryFunction::StopSkippingPickerForTest(); | 67 FileSystemChooseEntryFunction::StopSkippingPickerForTest(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 #if !defined(OS_CHROMEOS) | 70 #if !defined(OS_CHROMEOS) |
| 71 void ImageWriterUtilityClientCall() { | 71 void ImageWriterUtilityClientCall() { |
| 72 content::BrowserThread::PostTask( | 72 content::BrowserThread::PostTask( |
| 73 content::BrowserThread::FILE, | 73 content::BrowserThread::FILE, FROM_HERE, |
| 74 FROM_HERE, | 74 base::BindOnce(&FakeImageWriterClient::Progress, |
| 75 base::Bind(&FakeImageWriterClient::Progress, | 75 test_utils_.GetUtilityClient(), 0)); |
| 76 test_utils_.GetUtilityClient(), | |
| 77 0)); | |
| 78 content::BrowserThread::PostTask( | 76 content::BrowserThread::PostTask( |
| 79 content::BrowserThread::FILE, | 77 content::BrowserThread::FILE, FROM_HERE, |
| 80 FROM_HERE, | 78 base::BindOnce(&FakeImageWriterClient::Progress, |
| 81 base::Bind(&FakeImageWriterClient::Progress, | 79 test_utils_.GetUtilityClient(), 50)); |
| 82 test_utils_.GetUtilityClient(), | |
| 83 50)); | |
| 84 content::BrowserThread::PostTask( | 80 content::BrowserThread::PostTask( |
| 85 content::BrowserThread::FILE, | 81 content::BrowserThread::FILE, FROM_HERE, |
| 86 FROM_HERE, | 82 base::BindOnce(&FakeImageWriterClient::Progress, |
| 87 base::Bind(&FakeImageWriterClient::Progress, | 83 test_utils_.GetUtilityClient(), 100)); |
| 88 test_utils_.GetUtilityClient(), | |
| 89 100)); | |
| 90 content::BrowserThread::PostTask( | 84 content::BrowserThread::PostTask( |
| 91 content::BrowserThread::FILE, | 85 content::BrowserThread::FILE, FROM_HERE, |
| 92 FROM_HERE, | 86 base::BindOnce(&FakeImageWriterClient::Success, |
| 93 base::Bind(&FakeImageWriterClient::Success, | 87 test_utils_.GetUtilityClient())); |
| 94 test_utils_.GetUtilityClient())); | |
| 95 } | 88 } |
| 96 #endif | 89 #endif |
| 97 | 90 |
| 98 protected: | 91 protected: |
| 99 base::MessageLoopForUI message_loop_; | 92 base::MessageLoopForUI message_loop_; |
| 100 image_writer::ImageWriterTestUtils test_utils_; | 93 image_writer::ImageWriterTestUtils test_utils_; |
| 101 }; | 94 }; |
| 102 | 95 |
| 103 IN_PROC_BROWSER_TEST_F(ImageWriterPrivateApiTest, TestListDevices) { | 96 IN_PROC_BROWSER_TEST_F(ImageWriterPrivateApiTest, TestListDevices) { |
| 104 ASSERT_TRUE(RunExtensionTest("image_writer_private/list_devices")) | 97 ASSERT_TRUE(RunExtensionTest("image_writer_private/list_devices")) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 120 test_utils_.GetUtilityClient()->SetVerifyCallback(base::Bind( | 113 test_utils_.GetUtilityClient()->SetVerifyCallback(base::Bind( |
| 121 &ImageWriterPrivateApiTest::ImageWriterUtilityClientCall, | 114 &ImageWriterPrivateApiTest::ImageWriterUtilityClientCall, |
| 122 base::Unretained(this))); | 115 base::Unretained(this))); |
| 123 #endif | 116 #endif |
| 124 | 117 |
| 125 ASSERT_TRUE(RunPlatformAppTest("image_writer_private/write_from_file")) | 118 ASSERT_TRUE(RunPlatformAppTest("image_writer_private/write_from_file")) |
| 126 << message_; | 119 << message_; |
| 127 } | 120 } |
| 128 | 121 |
| 129 } // namespace extensions | 122 } // namespace extensions |
| OLD | NEW |