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

Unified Diff: chrome/browser/extensions/api/image_writer_private/write_from_url_operation_unittest.cc

Issue 382053004: Adds API test for imageWriterPrivate.writeFromFile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes memory leak. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/image_writer_private/write_from_url_operation_unittest.cc
diff --git a/chrome/browser/extensions/api/image_writer_private/write_from_url_operation_unittest.cc b/chrome/browser/extensions/api/image_writer_private/write_from_url_operation_unittest.cc
index 771af5a496978146e75d150a73727cceb3155cf8..fdfc3dc5883879542afef680fa560701b501e4b4 100644
--- a/chrome/browser/extensions/api/image_writer_private/write_from_url_operation_unittest.cc
+++ b/chrome/browser/extensions/api/image_writer_private/write_from_url_operation_unittest.cc
@@ -77,7 +77,8 @@ class ImageWriterWriteFromUrlOperationTest : public ImageWriterUnitTestBase {
// Turn on interception and set up our dummy file.
net::URLFetcher::SetEnableInterceptionForTests(true);
get_interceptor_.reset(new GetInterceptor());
- get_interceptor_->SetResponse(GURL(kTestImageUrl), test_image_path_);
+ get_interceptor_->SetResponse(GURL(kTestImageUrl),
+ test_utils_.GetImagePath());
}
virtual void TearDown() OVERRIDE {
@@ -95,7 +96,7 @@ class ImageWriterWriteFromUrlOperationTest : public ImageWriterUnitTestBase {
test_profile_.GetRequestContext(),
url,
hash,
- test_device_path_.AsUTF8Unsafe()));
+ test_utils_.GetDevicePath().AsUTF8Unsafe()));
operation->Start();
return operation;
}
@@ -140,8 +141,8 @@ TEST_F(ImageWriterWriteFromUrlOperationTest, DownloadFile) {
scoped_refptr<OperationForTest> operation =
CreateOperation(GURL(kTestImageUrl), "");
- EXPECT_TRUE(
- base::CreateTemporaryFileInDir(temp_dir_.path(), &download_target_path));
+ EXPECT_TRUE(base::CreateTemporaryFileInDir(test_utils_.GetTempDir(),
+ &download_target_path));
operation->SetImagePath(download_target_path);
EXPECT_CALL(
@@ -164,7 +165,8 @@ TEST_F(ImageWriterWriteFromUrlOperationTest, DownloadFile) {
runloop.Run();
- EXPECT_TRUE(base::ContentsEqual(test_image_path_, operation->GetImagePath()));
+ EXPECT_TRUE(base::ContentsEqual(test_utils_.GetImagePath(),
+ operation->GetImagePath()));
EXPECT_EQ(1, get_interceptor_->GetHitCount());
@@ -173,7 +175,7 @@ TEST_F(ImageWriterWriteFromUrlOperationTest, DownloadFile) {
TEST_F(ImageWriterWriteFromUrlOperationTest, VerifyFile) {
scoped_ptr<char[]> data_buffer(new char[kTestFileSize]);
- base::ReadFile(test_image_path_, data_buffer.get(), kTestFileSize);
+ base::ReadFile(test_utils_.GetImagePath(), data_buffer.get(), kTestFileSize);
base::MD5Digest expected_digest;
base::MD5Sum(data_buffer.get(), kTestFileSize, &expected_digest);
std::string expected_hash = base::MD5DigestToBase16(expected_digest);
@@ -194,7 +196,7 @@ TEST_F(ImageWriterWriteFromUrlOperationTest, VerifyFile) {
image_writer_api::STAGE_VERIFYDOWNLOAD,
100)).Times(AtLeast(1));
- operation->SetImagePath(test_image_path_);
+ operation->SetImagePath(test_utils_.GetImagePath());
content::BrowserThread::PostTask(content::BrowserThread::FILE,
FROM_HERE,
base::Bind(&OperationForTest::VerifyDownload,
« no previous file with comments | « chrome/browser/extensions/api/image_writer_private/write_from_file_operation_unittest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698