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

Side by Side Diff: chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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) 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 "chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.h" 5 #include "chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 base::Value* value) { 191 base::Value* value) {
192 web_ui()->CallJavascriptFunction("NetInternalsTest.callback", *value); 192 web_ui()->CallJavascriptFunction("NetInternalsTest.callback", *value);
193 } 193 }
194 194
195 void NetInternalsTest::MessageHandler::GetTestServerURL( 195 void NetInternalsTest::MessageHandler::GetTestServerURL(
196 const base::ListValue* list_value) { 196 const base::ListValue* list_value) {
197 ASSERT_TRUE(net_internals_test_->StartTestServer()); 197 ASSERT_TRUE(net_internals_test_->StartTestServer());
198 std::string path; 198 std::string path;
199 ASSERT_TRUE(list_value->GetString(0, &path)); 199 ASSERT_TRUE(list_value->GetString(0, &path));
200 GURL url = net_internals_test_->embedded_test_server()->GetURL(path); 200 GURL url = net_internals_test_->embedded_test_server()->GetURL(path);
201 scoped_ptr<base::Value> url_value(new base::StringValue(url.spec())); 201 std::unique_ptr<base::Value> url_value(new base::StringValue(url.spec()));
202 RunJavascriptCallback(url_value.get()); 202 RunJavascriptCallback(url_value.get());
203 } 203 }
204 204
205 void NetInternalsTest::MessageHandler::AddCacheEntry( 205 void NetInternalsTest::MessageHandler::AddCacheEntry(
206 const base::ListValue* list_value) { 206 const base::ListValue* list_value) {
207 std::string hostname; 207 std::string hostname;
208 std::string ip_literal; 208 std::string ip_literal;
209 double net_error; 209 double net_error;
210 double expire_days_from_now; 210 double expire_days_from_now;
211 ASSERT_TRUE(list_value->GetString(0, &hostname)); 211 ASSERT_TRUE(list_value->GetString(0, &hostname));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 void NetInternalsTest::MessageHandler::GetNetLogFileContents( 279 void NetInternalsTest::MessageHandler::GetNetLogFileContents(
280 const base::ListValue* list_value) { 280 const base::ListValue* list_value) {
281 base::ScopedTempDir temp_directory; 281 base::ScopedTempDir temp_directory;
282 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); 282 ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
283 base::FilePath temp_file; 283 base::FilePath temp_file;
284 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(), 284 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(),
285 &temp_file)); 285 &temp_file));
286 base::ScopedFILE temp_file_handle(base::OpenFile(temp_file, "w")); 286 base::ScopedFILE temp_file_handle(base::OpenFile(temp_file, "w"));
287 ASSERT_TRUE(temp_file_handle); 287 ASSERT_TRUE(temp_file_handle);
288 288
289 scoped_ptr<base::Value> constants(net_log::ChromeNetLog::GetConstants( 289 std::unique_ptr<base::Value> constants(net_log::ChromeNetLog::GetConstants(
290 base::CommandLine::ForCurrentProcess()->GetCommandLineString(), 290 base::CommandLine::ForCurrentProcess()->GetCommandLineString(),
291 chrome::GetChannelString())); 291 chrome::GetChannelString()));
292 scoped_ptr<net::WriteToFileNetLogObserver> net_log_logger( 292 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_logger(
293 new net::WriteToFileNetLogObserver()); 293 new net::WriteToFileNetLogObserver());
294 net_log_logger->StartObserving(g_browser_process->net_log(), 294 net_log_logger->StartObserving(g_browser_process->net_log(),
295 std::move(temp_file_handle), constants.get(), 295 std::move(temp_file_handle), constants.get(),
296 nullptr); 296 nullptr);
297 g_browser_process->net_log()->AddGlobalEntry( 297 g_browser_process->net_log()->AddGlobalEntry(
298 net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED); 298 net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED);
299 net::BoundNetLog bound_net_log = net::BoundNetLog::Make( 299 net::BoundNetLog bound_net_log = net::BoundNetLog::Make(
300 g_browser_process->net_log(), 300 g_browser_process->net_log(),
301 net::NetLog::SOURCE_URL_REQUEST); 301 net::NetLog::SOURCE_URL_REQUEST);
302 bound_net_log.BeginEvent(net::NetLog::TYPE_REQUEST_ALIVE); 302 bound_net_log.BeginEvent(net::NetLog::TYPE_REQUEST_ALIVE);
303 net_log_logger->StopObserving(nullptr); 303 net_log_logger->StopObserving(nullptr);
304 net_log_logger.reset(); 304 net_log_logger.reset();
305 305
306 std::string log_contents; 306 std::string log_contents;
307 ASSERT_TRUE(base::ReadFileToString(temp_file, &log_contents)); 307 ASSERT_TRUE(base::ReadFileToString(temp_file, &log_contents));
308 ASSERT_GT(log_contents.length(), 0u); 308 ASSERT_GT(log_contents.length(), 0u);
309 309
310 scoped_ptr<base::Value> log_contents_value( 310 std::unique_ptr<base::Value> log_contents_value(
311 new base::StringValue(log_contents)); 311 new base::StringValue(log_contents));
312 RunJavascriptCallback(log_contents_value.get()); 312 RunJavascriptCallback(log_contents_value.get());
313 } 313 }
314 314
315 void NetInternalsTest::MessageHandler::EnableDataReductionProxy( 315 void NetInternalsTest::MessageHandler::EnableDataReductionProxy(
316 const base::ListValue* list_value) { 316 const base::ListValue* list_value) {
317 bool enable; 317 bool enable;
318 ASSERT_TRUE(list_value->GetBoolean(0, &enable)); 318 ASSERT_TRUE(list_value->GetBoolean(0, &enable));
319 browser()->profile()->GetPrefs()->SetBoolean( 319 browser()->profile()->GetPrefs()->SetBoolean(
320 prefs::kDataSaverEnabled, enable); 320 prefs::kDataSaverEnabled, enable);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 if (test_server_started_) 370 if (test_server_started_)
371 return true; 371 return true;
372 test_server_started_ = embedded_test_server()->Start(); 372 test_server_started_ = embedded_test_server()->Start();
373 373
374 // Sample domain for SDCH-view test. Dictionaries for localhost/127.0.0.1 374 // Sample domain for SDCH-view test. Dictionaries for localhost/127.0.0.1
375 // are forbidden. 375 // are forbidden.
376 host_resolver()->AddRule("testdomain.com", "127.0.0.1"); 376 host_resolver()->AddRule("testdomain.com", "127.0.0.1");
377 host_resolver()->AddRule("sub.testdomain.com", "127.0.0.1"); 377 host_resolver()->AddRule("sub.testdomain.com", "127.0.0.1");
378 return test_server_started_; 378 return test_server_started_;
379 } 379 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698