OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "content/browser/download/download_create_info.h" | 8 #include "content/browser/download/download_create_info.h" |
9 #include "content/browser/download/download_file.h" | 9 #include "content/browser/download/download_file.h" |
10 #include "content/browser/download/download_id.h" | 10 #include "content/browser/download/download_id.h" |
11 #include "content/browser/download/download_id_factory.h" | 11 #include "content/browser/download/download_id_factory.h" |
12 #include "content/browser/download/download_manager.h" | 12 #include "content/browser/download/download_manager.h" |
13 #include "content/browser/download/download_request_handle.h" | 13 #include "content/browser/download/download_request_handle.h" |
14 #include "content/browser/download/download_status_updater.h" | 14 #include "content/browser/download/download_status_updater.h" |
15 #include "content/browser/download/mock_download_manager.h" | 15 #include "content/browser/download/mock_download_manager.h" |
16 #include "content/browser/download/mock_download_manager_delegate.h" | 16 #include "content/browser/download/mock_download_manager_delegate.h" |
17 #include "content/test/test_browser_thread.h" | 17 #include "content/test/test_browser_thread.h" |
18 #include "net/base/file_stream.h" | 18 #include "net/base/file_stream.h" |
19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 | 21 |
| 22 using content::BrowserThread; |
| 23 |
22 DownloadId::Domain kValidIdDomain = "valid DownloadId::Domain"; | 24 DownloadId::Domain kValidIdDomain = "valid DownloadId::Domain"; |
23 | 25 |
24 class DownloadFileTest : public testing::Test { | 26 class DownloadFileTest : public testing::Test { |
25 public: | 27 public: |
26 | 28 |
27 static const char* kTestData1; | 29 static const char* kTestData1; |
28 static const char* kTestData2; | 30 static const char* kTestData2; |
29 static const char* kTestData3; | 31 static const char* kTestData3; |
30 static const char* kDataHash; | 32 static const char* kDataHash; |
31 static const int32 kDummyDownloadId; | 33 static const int32 kDummyDownloadId; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // Check the files. | 193 // Check the files. |
192 EXPECT_FALSE(file_util::PathExists(path_3)); | 194 EXPECT_FALSE(file_util::PathExists(path_3)); |
193 EXPECT_TRUE(file_util::PathExists(path_4)); | 195 EXPECT_TRUE(file_util::PathExists(path_4)); |
194 | 196 |
195 // Check the hash. | 197 // Check the hash. |
196 EXPECT_TRUE(download_file_->GetSha256Hash(&hash)); | 198 EXPECT_TRUE(download_file_->GetSha256Hash(&hash)); |
197 EXPECT_EQ(kDataHash, base::HexEncode(hash.data(), hash.size())); | 199 EXPECT_EQ(kDataHash, base::HexEncode(hash.data(), hash.size())); |
198 | 200 |
199 DestroyDownloadFile(&download_file_, 0); | 201 DestroyDownloadFile(&download_file_, 0); |
200 } | 202 } |
OLD | NEW |