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

Side by Side Diff: content/browser/download/base_file_unittest.cc

Issue 10831302: Download resumption - Preliminary (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed content unit tests. Created 8 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/download/base_file.h" 5 #include "content/browser/download/base_file.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 // Create another file 407 // Create another file
408 linked_ptr<net::FileStream> second_stream; 408 linked_ptr<net::FileStream> second_stream;
409 BaseFile second_file(FilePath(), 409 BaseFile second_file(FilePath(),
410 GURL(), 410 GURL(),
411 GURL(), 411 GURL(),
412 base_file_->bytes_so_far(), 412 base_file_->bytes_so_far(),
413 true, 413 true,
414 hash_state, 414 hash_state,
415 second_stream, 415 second_stream,
416 net::BoundNetLog()); 416 net::BoundNetLog());
417 ASSERT_EQ(net::OK, second_file.Initialize(temp_dir_.path())); 417 ASSERT_EQ(net::ERR_UNEXPECTED, second_file.Initialize(temp_dir_.path()));
418 std::string data(kTestData3); 418 std::string data(kTestData3);
419 EXPECT_EQ(net::OK, second_file.AppendDataToFile(data.data(), data.size())); 419 EXPECT_EQ(net::OK, second_file.AppendDataToFile(data.data(), data.size()));
420 second_file.Finish(); 420 second_file.Finish();
421 421
422 std::string hash; 422 std::string hash;
423 EXPECT_TRUE(second_file.GetHash(&hash)); 423 EXPECT_TRUE(second_file.GetHash(&hash));
424 // This will fail until getting the hash state is supported in SecureHash. 424 // This will fail until getting the hash state is supported in SecureHash.
425 EXPECT_STREQ(expected_hash_hex.c_str(), 425 EXPECT_STREQ(expected_hash_hex.c_str(),
426 base::HexEncode(hash.data(), hash.size()).c_str()); 426 base::HexEncode(hash.data(), hash.size()).c_str());
427 } 427 }
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 // be a string-wise match to base_file_->full_path().DirName() even though 653 // be a string-wise match to base_file_->full_path().DirName() even though
654 // they are in the same directory. 654 // they are in the same directory.
655 FilePath temp_file; 655 FilePath temp_file;
656 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), 656 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(),
657 &temp_file)); 657 &temp_file));
658 ASSERT_FALSE(temp_file.empty()); 658 ASSERT_FALSE(temp_file.empty());
659 EXPECT_STREQ(temp_file.DirName().value().c_str(), 659 EXPECT_STREQ(temp_file.DirName().value().c_str(),
660 base_file_->full_path().DirName().value().c_str()); 660 base_file_->full_path().DirName().value().c_str());
661 base_file_->Finish(); 661 base_file_->Finish();
662 } 662 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698