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

Side by Side Diff: components/history/core/test/fake_web_history_service.cc

Issue 1548113002: Switch to standard integer types in components/, part 2 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/history/core/test/fake_web_history_service.h" 5 #include "components/history/core/test/fake_web_history_service.h"
6 6
7 #include <stdint.h>
8
7 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/macros.h"
8 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
9 #include "base/time/time.h" 12 #include "base/time/time.h"
10 #include "net/base/url_util.h" 13 #include "net/base/url_util.h"
11 #include "net/url_request/url_request_context_getter.h" 14 #include "net/url_request/url_request_context_getter.h"
12 15
13 namespace history { 16 namespace history {
14 17
15 // FakeRequest ----------------------------------------------------------------- 18 // FakeRequest -----------------------------------------------------------------
16 19
17 namespace { 20 namespace {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 138 }
136 return result; 139 return result;
137 } 140 }
138 141
139 base::Time FakeWebHistoryService::GetTimeForKeyInQuery( 142 base::Time FakeWebHistoryService::GetTimeForKeyInQuery(
140 const GURL& url, const std::string& key) { 143 const GURL& url, const std::string& key) {
141 std::string value; 144 std::string value;
142 if (!net::GetValueForKeyInQuery(url, key, &value)) 145 if (!net::GetValueForKeyInQuery(url, key, &value))
143 return base::Time(); 146 return base::Time();
144 147
145 int64 us; 148 int64_t us;
146 if (!base::StringToInt64(value, &us)) 149 if (!base::StringToInt64(value, &us))
147 return base::Time(); 150 return base::Time();
148 return base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(us); 151 return base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(us);
149 } 152 }
150 153
151 FakeWebHistoryService::Request* FakeWebHistoryService::CreateRequest( 154 FakeWebHistoryService::Request* FakeWebHistoryService::CreateRequest(
152 const GURL& url, const CompletionCallback& callback) { 155 const GURL& url, const CompletionCallback& callback) {
153 // Find the time range endpoints in the URL. 156 // Find the time range endpoints in the URL.
154 base::Time begin = GetTimeForKeyInQuery(url, "min"); 157 base::Time begin = GetTimeForKeyInQuery(url, "min");
155 base::Time end = GetTimeForKeyInQuery(url, "max"); 158 base::Time end = GetTimeForKeyInQuery(url, "max");
156 159
157 if (end.is_null()) 160 if (end.is_null())
158 end = base::Time::Max(); 161 end = base::Time::Max();
159 162
160 int max_count = 0; 163 int max_count = 0;
161 std::string max_count_str; 164 std::string max_count_str;
162 if (net::GetValueForKeyInQuery(url, "num", &max_count_str)) 165 if (net::GetValueForKeyInQuery(url, "num", &max_count_str))
163 base::StringToInt(max_count_str, &max_count); 166 base::StringToInt(max_count_str, &max_count);
164 167
165 return new FakeRequest(this, emulate_success_, emulate_response_code_, 168 return new FakeRequest(this, emulate_success_, emulate_response_code_,
166 callback, begin, end, max_count); 169 callback, begin, end, max_count);
167 } 170 }
168 171
169 } // namespace history 172 } // namespace history
OLDNEW
« no previous file with comments | « components/history/core/common/thumbnail_score.cc ('k') | components/history/core/test/history_backend_db_base_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698