| OLD | NEW |
| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS } | 1123 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS } |
| 1124 }; | 1124 }; |
| 1125 DownloadManager::DownloadVector all_downloads; | 1125 DownloadManager::DownloadVector all_downloads; |
| 1126 ASSERT_TRUE(CreateHistoryDownloads(kHistoryInfo, arraysize(kHistoryInfo), | 1126 ASSERT_TRUE(CreateHistoryDownloads(kHistoryInfo, arraysize(kHistoryInfo), |
| 1127 &all_downloads)); | 1127 &all_downloads)); |
| 1128 | 1128 |
| 1129 base::FilePath real_path = all_downloads[0]->GetTargetFilePath(); | 1129 base::FilePath real_path = all_downloads[0]->GetTargetFilePath(); |
| 1130 base::FilePath fake_path = all_downloads[1]->GetTargetFilePath(); | 1130 base::FilePath fake_path = all_downloads[1]->GetTargetFilePath(); |
| 1131 | 1131 |
| 1132 EXPECT_EQ(0, file_util::WriteFile(real_path, "", 0)); | 1132 EXPECT_EQ(0, file_util::WriteFile(real_path, "", 0)); |
| 1133 ASSERT_TRUE(file_util::PathExists(real_path)); | 1133 ASSERT_TRUE(base::PathExists(real_path)); |
| 1134 ASSERT_FALSE(file_util::PathExists(fake_path)); | 1134 ASSERT_FALSE(base::PathExists(fake_path)); |
| 1135 | 1135 |
| 1136 for (DownloadManager::DownloadVector::iterator iter = all_downloads.begin(); | 1136 for (DownloadManager::DownloadVector::iterator iter = all_downloads.begin(); |
| 1137 iter != all_downloads.end(); | 1137 iter != all_downloads.end(); |
| 1138 ++iter) { | 1138 ++iter) { |
| 1139 std::string result_string; | 1139 std::string result_string; |
| 1140 // Use a MockIconExtractorImpl to test if the correct path is being passed | 1140 // Use a MockIconExtractorImpl to test if the correct path is being passed |
| 1141 // into the DownloadFileIconExtractor. | 1141 // into the DownloadFileIconExtractor. |
| 1142 EXPECT_TRUE(RunFunctionAndReturnString(MockedGetFileIconFunction( | 1142 EXPECT_TRUE(RunFunctionAndReturnString(MockedGetFileIconFunction( |
| 1143 (*iter)->GetTargetFilePath(), IconLoader::NORMAL, "hello"), | 1143 (*iter)->GetTargetFilePath(), IconLoader::NORMAL, "hello"), |
| 1144 base::StringPrintf("[%d, {\"size\": 32}]", (*iter)->GetId()), | 1144 base::StringPrintf("[%d, {\"size\": 32}]", (*iter)->GetId()), |
| (...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3525 DownloadsApiTest() {} | 3525 DownloadsApiTest() {} |
| 3526 virtual ~DownloadsApiTest() {} | 3526 virtual ~DownloadsApiTest() {} |
| 3527 private: | 3527 private: |
| 3528 DISALLOW_COPY_AND_ASSIGN(DownloadsApiTest); | 3528 DISALLOW_COPY_AND_ASSIGN(DownloadsApiTest); |
| 3529 }; | 3529 }; |
| 3530 | 3530 |
| 3531 | 3531 |
| 3532 IN_PROC_BROWSER_TEST_F(DownloadsApiTest, DownloadsApiTest) { | 3532 IN_PROC_BROWSER_TEST_F(DownloadsApiTest, DownloadsApiTest) { |
| 3533 ASSERT_TRUE(RunExtensionTest("downloads")) << message_; | 3533 ASSERT_TRUE(RunExtensionTest("downloads")) << message_; |
| 3534 } | 3534 } |
| OLD | NEW |