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

Side by Side Diff: chrome/browser/chromeos/drive/download_handler_unittest.cc

Issue 1547093002: Switch to standard integer types in chrome/browser/chromeos/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/browser/chromeos/drive/download_handler.h" 5 #include "chrome/browser/chromeos/drive/download_handler.h"
6 6
7 #include <stdint.h>
8
7 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
8 #include "base/run_loop.h" 10 #include "base/run_loop.h"
9 #include "chrome/browser/chromeos/drive/file_system_util.h" 11 #include "chrome/browser/chromeos/drive/file_system_util.h"
10 #include "chrome/test/base/testing_profile.h" 12 #include "chrome/test/base/testing_profile.h"
11 #include "components/drive/dummy_file_system.h" 13 #include "components/drive/dummy_file_system.h"
12 #include "components/drive/file_system_core_util.h" 14 #include "components/drive/file_system_core_util.h"
13 #include "content/public/test/mock_download_item.h" 15 #include "content/public/test/mock_download_item.h"
14 #include "content/public/test/mock_download_manager.h" 16 #include "content/public/test/mock_download_manager.h"
15 #include "content/public/test/test_browser_thread_bundle.h" 17 #include "content/public/test/test_browser_thread_bundle.h"
16 #include "content/public/test/test_utils.h" 18 #include "content/public/test/test_utils.h"
(...skipping 20 matching lines...) Expand all
37 } 39 }
38 40
39 void CreateDirectory(const base::FilePath& directory_path, 41 void CreateDirectory(const base::FilePath& directory_path,
40 bool is_exclusive, 42 bool is_exclusive,
41 bool is_recursive, 43 bool is_recursive,
42 const FileOperationCallback& callback) override { 44 const FileOperationCallback& callback) override {
43 callback.Run(error_); 45 callback.Run(error_);
44 } 46 }
45 47
46 void FreeDiskSpaceIfNeededFor( 48 void FreeDiskSpaceIfNeededFor(
47 int64 num_bytes, 49 int64_t num_bytes,
48 const FreeDiskSpaceCallback& callback) override { 50 const FreeDiskSpaceCallback& callback) override {
49 free_disk_space_if_needed_for_num_bytes_.push_back(num_bytes); 51 free_disk_space_if_needed_for_num_bytes_.push_back(num_bytes);
50 callback.Run(true); 52 callback.Run(true);
51 } 53 }
52 54
53 std::vector<int64> free_disk_space_if_needed_for_num_bytes_; 55 std::vector<int64_t> free_disk_space_if_needed_for_num_bytes_;
54 56
55 private: 57 private:
56 FileError error_; 58 FileError error_;
57 }; 59 };
58 60
59 class DownloadHandlerTestDownloadManager : public content::MockDownloadManager { 61 class DownloadHandlerTestDownloadManager : public content::MockDownloadManager {
60 public: 62 public:
61 void GetAllDownloads( 63 void GetAllDownloads(
62 content::DownloadManager::DownloadVector* downloads) override { 64 content::DownloadManager::DownloadVector* downloads) override {
63 for (auto* test_download : test_downloads_) { 65 for (auto* test_download : test_downloads_) {
64 downloads->push_back(test_download); 66 downloads->push_back(test_download);
65 } 67 }
66 } 68 }
67 69
68 content::DownloadManager::DownloadVector test_downloads_; 70 content::DownloadManager::DownloadVector test_downloads_;
69 }; 71 };
70 72
71 class DownloadHandlerTestDownloadItem : public content::MockDownloadItem { 73 class DownloadHandlerTestDownloadItem : public content::MockDownloadItem {
72 public: 74 public:
73 bool IsDone() const override { return is_done_; } 75 bool IsDone() const override { return is_done_; }
74 76
75 int64 GetTotalBytes() const override { return total_bytes_; } 77 int64_t GetTotalBytes() const override { return total_bytes_; }
76 78
77 int64 GetReceivedBytes() const override { return received_bytes_; } 79 int64_t GetReceivedBytes() const override { return received_bytes_; }
78 80
79 bool is_done_ = false; 81 bool is_done_ = false;
80 int64 total_bytes_ = 0; 82 int64_t total_bytes_ = 0;
81 int64 received_bytes_ = 0; 83 int64_t received_bytes_ = 0;
82 }; 84 };
83 85
84 } // namespace 86 } // namespace
85 87
86 class DownloadHandlerTest : public testing::Test { 88 class DownloadHandlerTest : public testing::Test {
87 public: 89 public:
88 DownloadHandlerTest() 90 DownloadHandlerTest()
89 : download_manager_(new DownloadHandlerTestDownloadManager) {} 91 : download_manager_(new DownloadHandlerTestDownloadManager) {}
90 92
91 void SetUp() override { 93 void SetUp() override {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 download_item_d.is_done_ = false; 346 download_item_d.is_done_ = false;
345 download_item_d.total_bytes_ = 0; 347 download_item_d.total_bytes_ = 0;
346 downloads.push_back(&download_item_d); 348 downloads.push_back(&download_item_d);
347 349
348 // Unknown size downloads should be counted as 0 byte. 350 // Unknown size downloads should be counted as 0 byte.
349 ASSERT_EQ(download_item_a.total_bytes_ - download_item_a.received_bytes_, 351 ASSERT_EQ(download_item_a.total_bytes_ - download_item_a.received_bytes_,
350 download_handler_->CalculateRequestSpace(downloads)); 352 download_handler_->CalculateRequestSpace(downloads));
351 } 353 }
352 354
353 } // namespace drive 355 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/download_handler.cc ('k') | chrome/browser/chromeos/drive/drive_file_stream_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698