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

Unified Diff: content/browser/download/download_manager_impl_unittest.cc

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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: content/browser/download/download_manager_impl_unittest.cc
diff --git a/content/browser/download/download_manager_impl_unittest.cc b/content/browser/download/download_manager_impl_unittest.cc
index 2878cda14ebc4dcf02b30e73457f69730710976b..cf73cc171011af1a020492e210a1327741e1cb9c 100644
--- a/content/browser/download/download_manager_impl_unittest.cc
+++ b/content/browser/download/download_manager_impl_unittest.cc
@@ -2,11 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <stddef.h>
+#include <stdint.h>
+
#include <set>
#include <string>
#include "base/bind.h"
#include "base/files/scoped_temp_dir.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
@@ -106,7 +110,7 @@ class MockDownloadItemImpl : public DownloadItemImpl {
MOCK_METHOD0(ShowDownloadInShell, void());
MOCK_METHOD0(ValidateDangerousDownload, void());
MOCK_METHOD1(StealDangerousDownload, void(const AcquireFileCallback&));
- MOCK_METHOD3(UpdateProgress, void(int64, int64, const std::string&));
+ MOCK_METHOD3(UpdateProgress, void(int64_t, int64_t, const std::string&));
MOCK_METHOD1(Cancel, void(bool));
MOCK_METHOD0(MarkAsComplete, void());
MOCK_METHOD1(OnAllDataSaved, void(const std::string&));
@@ -120,7 +124,7 @@ class MockDownloadItemImpl : public DownloadItemImpl {
MOCK_METHOD0(Remove, void());
MOCK_CONST_METHOD1(TimeRemaining, bool(base::TimeDelta*));
- MOCK_CONST_METHOD0(CurrentSpeed, int64());
+ MOCK_CONST_METHOD0(CurrentSpeed, int64_t());
MOCK_CONST_METHOD0(PercentComplete, int());
MOCK_CONST_METHOD0(AllDataSaved, bool());
MOCK_CONST_METHOD1(MatchesQuery, bool(const base::string16& query));
@@ -131,7 +135,7 @@ class MockDownloadItemImpl : public DownloadItemImpl {
MOCK_METHOD1(OnContentCheckCompleted, void(DownloadDangerType));
MOCK_CONST_METHOD0(GetState, DownloadState());
MOCK_CONST_METHOD0(GetUrlChain, const std::vector<GURL>&());
- MOCK_METHOD1(SetTotalBytes, void(int64));
+ MOCK_METHOD1(SetTotalBytes, void(int64_t));
MOCK_CONST_METHOD0(GetURL, const GURL&());
MOCK_CONST_METHOD0(GetOriginalUrl, const GURL&());
MOCK_CONST_METHOD0(GetReferrerUrl, const GURL&());
@@ -143,11 +147,11 @@ class MockDownloadItemImpl : public DownloadItemImpl {
MOCK_CONST_METHOD0(GetOriginalMimeType, std::string());
MOCK_CONST_METHOD0(GetReferrerCharset, std::string());
MOCK_CONST_METHOD0(GetRemoteAddress, std::string());
- MOCK_CONST_METHOD0(GetTotalBytes, int64());
- MOCK_CONST_METHOD0(GetReceivedBytes, int64());
+ MOCK_CONST_METHOD0(GetTotalBytes, int64_t());
+ MOCK_CONST_METHOD0(GetReceivedBytes, int64_t());
MOCK_CONST_METHOD0(GetHashState, const std::string&());
MOCK_CONST_METHOD0(GetHash, const std::string&());
- MOCK_CONST_METHOD0(GetId, uint32());
+ MOCK_CONST_METHOD0(GetId, uint32_t());
MOCK_CONST_METHOD0(GetStartTime, base::Time());
MOCK_CONST_METHOD0(GetEndTime, base::Time());
MOCK_METHOD0(GetDownloadManager, DownloadManager*());
@@ -232,7 +236,7 @@ class MockDownloadItemFactory
// Overridden methods from DownloadItemFactory.
DownloadItemImpl* CreatePersistedItem(
DownloadItemImplDelegate* delegate,
- uint32 download_id,
+ uint32_t download_id,
const base::FilePath& current_path,
const base::FilePath& target_path,
const std::vector<GURL>& url_chain,
@@ -243,8 +247,8 @@ class MockDownloadItemFactory
const base::Time& end_time,
const std::string& etag,
const std::string& last_modofied,
- int64 received_bytes,
- int64 total_bytes,
+ int64_t received_bytes,
+ int64_t total_bytes,
DownloadItem::DownloadState state,
DownloadDangerType danger_type,
DownloadInterruptReason interrupt_reason,
@@ -252,12 +256,12 @@ class MockDownloadItemFactory
const net::BoundNetLog& bound_net_log) override;
DownloadItemImpl* CreateActiveItem(
DownloadItemImplDelegate* delegate,
- uint32 download_id,
+ uint32_t download_id,
const DownloadCreateInfo& info,
const net::BoundNetLog& bound_net_log) override;
DownloadItemImpl* CreateSavePageItem(
DownloadItemImplDelegate* delegate,
- uint32 download_id,
+ uint32_t download_id,
const base::FilePath& path,
const GURL& url,
const std::string& mime_type,
@@ -265,7 +269,7 @@ class MockDownloadItemFactory
const net::BoundNetLog& bound_net_log) override;
private:
- std::map<uint32, MockDownloadItemImpl*> items_;
+ std::map<uint32_t, MockDownloadItemImpl*> items_;
DownloadItemImplDelegate item_delegate_;
DISALLOW_COPY_AND_ASSIGN(MockDownloadItemFactory);
@@ -285,8 +289,8 @@ MockDownloadItemImpl* MockDownloadItemFactory::PopItem() {
if (items_.empty())
return NULL;
- std::map<uint32, MockDownloadItemImpl*>::iterator first_item
- = items_.begin();
+ std::map<uint32_t, MockDownloadItemImpl*>::iterator first_item =
+ items_.begin();
MockDownloadItemImpl* result = first_item->second;
items_.erase(first_item);
return result;
@@ -299,7 +303,7 @@ void MockDownloadItemFactory::RemoveItem(int id) {
DownloadItemImpl* MockDownloadItemFactory::CreatePersistedItem(
DownloadItemImplDelegate* delegate,
- uint32 download_id,
+ uint32_t download_id,
const base::FilePath& current_path,
const base::FilePath& target_path,
const std::vector<GURL>& url_chain,
@@ -310,8 +314,8 @@ DownloadItemImpl* MockDownloadItemFactory::CreatePersistedItem(
const base::Time& end_time,
const std::string& etag,
const std::string& last_modified,
- int64 received_bytes,
- int64 total_bytes,
+ int64_t received_bytes,
+ int64_t total_bytes,
DownloadItem::DownloadState state,
DownloadDangerType danger_type,
DownloadInterruptReason interrupt_reason,
@@ -328,7 +332,7 @@ DownloadItemImpl* MockDownloadItemFactory::CreatePersistedItem(
DownloadItemImpl* MockDownloadItemFactory::CreateActiveItem(
DownloadItemImplDelegate* delegate,
- uint32 download_id,
+ uint32_t download_id,
const DownloadCreateInfo& info,
const net::BoundNetLog& bound_net_log) {
DCHECK(items_.find(download_id) == items_.end());
@@ -348,7 +352,7 @@ DownloadItemImpl* MockDownloadItemFactory::CreateActiveItem(
DownloadItemImpl* MockDownloadItemFactory::CreateSavePageItem(
DownloadItemImplDelegate* delegate,
- uint32 download_id,
+ uint32_t download_id,
const base::FilePath& path,
const GURL& url,
const std::string& mime_type,
@@ -437,8 +441,7 @@ class MockDownloadManagerObserver : public DownloadManager::Observer {
MOCK_METHOD2(OnDownloadCreated, void(
DownloadManager*, DownloadItem*));
MOCK_METHOD1(ManagerGoingDown, void(DownloadManager*));
- MOCK_METHOD2(SelectFileDialogDisplayed, void(
- DownloadManager*, int32));
+ MOCK_METHOD2(SelectFileDialogDisplayed, void(DownloadManager*, int32_t));
};
} // namespace
@@ -517,7 +520,7 @@ class DownloadManagerTest : public testing::Test {
// Args are ignored except for download id, so everything else can be
// null.
- uint32 id = next_download_id_;
+ uint32_t id = next_download_id_;
++next_download_id_;
info.request_handle.reset(new DownloadRequestHandle);
download_manager_->CreateActiveItem(id, info);
@@ -595,7 +598,7 @@ class DownloadManagerTest : public testing::Test {
scoped_ptr<MockDownloadManagerDelegate> mock_download_manager_delegate_;
scoped_ptr<MockBrowserContext> mock_browser_context_;
scoped_ptr<MockDownloadManagerObserver> observer_;
- uint32 next_download_id_;
+ uint32_t next_download_id_;
DISALLOW_COPY_AND_ASSIGN(DownloadManagerTest);
};
@@ -604,7 +607,7 @@ class DownloadManagerTest : public testing::Test {
TEST_F(DownloadManagerTest, StartDownload) {
scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo);
scoped_ptr<ByteStreamReader> stream;
- uint32 local_id(5); // Random value
+ uint32_t local_id(5); // Random value
base::FilePath download_path(FILE_PATH_LITERAL("download/path"));
EXPECT_FALSE(download_manager_->GetDownload(local_id));
@@ -673,7 +676,7 @@ TEST_F(DownloadManagerTest, DetermineDownloadTarget_False) {
// Confirm the DownloadManagerImpl::RemoveAllDownloads() functionality
TEST_F(DownloadManagerTest, RemoveAllDownloads) {
base::Time now(base::Time::Now());
- for (uint32 i = 0; i < 4; ++i) {
+ for (uint32_t i = 0; i < 4; ++i) {
MockDownloadItemImpl& item(AddItemToManager());
EXPECT_EQ(i, item.GetId());
EXPECT_CALL(item, GetStartTime())
@@ -708,7 +711,7 @@ TEST_F(DownloadManagerTest, RemoveAllDownloads) {
// Confirm that only downloads with same origin are removed.
TEST_F(DownloadManagerTest, RemoveSameOriginDownloads) {
base::Time now(base::Time::Now());
- for (uint32 i = 0; i < 2; ++i) {
+ for (uint32_t i = 0; i < 2; ++i) {
MockDownloadItemImpl& item(AddItemToManager());
EXPECT_CALL(item, GetStartTime()).WillRepeatedly(Return(now));
EXPECT_CALL(item, GetState())
« no previous file with comments | « content/browser/download/download_manager_impl.cc ('k') | content/browser/download/download_net_log_parameters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698