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

Side by Side Diff: net/android/traffic_stats_unittest.cc

Issue 1893083002: Change scoped_ptr to std::unique_ptr in //net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-net-all: iwyu 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 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 "net/android/traffic_stats.h" 5 #include "net/android/traffic_stats.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "net/test/embedded_test_server/embedded_test_server.h" 8 #include "net/test/embedded_test_server/embedded_test_server.h"
9 #include "net/url_request/url_request_test_util.h" 9 #include "net/url_request/url_request_test_util.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 14 matching lines...) Expand all
25 EXPECT_TRUE( 25 EXPECT_TRUE(
26 android::traffic_stats::GetTotalTxBytes(&tx_bytes_before_request)); 26 android::traffic_stats::GetTotalTxBytes(&tx_bytes_before_request));
27 EXPECT_GE(tx_bytes_before_request, 0); 27 EXPECT_GE(tx_bytes_before_request, 0);
28 EXPECT_TRUE( 28 EXPECT_TRUE(
29 android::traffic_stats::GetTotalRxBytes(&rx_bytes_before_request)); 29 android::traffic_stats::GetTotalRxBytes(&rx_bytes_before_request));
30 EXPECT_GE(rx_bytes_before_request, 0); 30 EXPECT_GE(rx_bytes_before_request, 0);
31 31
32 TestDelegate test_delegate; 32 TestDelegate test_delegate;
33 TestURLRequestContext context(false); 33 TestURLRequestContext context(false);
34 34
35 scoped_ptr<URLRequest> request( 35 std::unique_ptr<URLRequest> request(
36 context.CreateRequest(embedded_test_server.GetURL("/echo.html"), 36 context.CreateRequest(embedded_test_server.GetURL("/echo.html"),
37 DEFAULT_PRIORITY, &test_delegate)); 37 DEFAULT_PRIORITY, &test_delegate));
38 request->Start(); 38 request->Start();
39 base::RunLoop().Run(); 39 base::RunLoop().Run();
40 40
41 // Bytes should increase because of the network traffic. 41 // Bytes should increase because of the network traffic.
42 int64_t tx_bytes_after_request = -1; 42 int64_t tx_bytes_after_request = -1;
43 int64_t rx_bytes_after_request = -1; 43 int64_t rx_bytes_after_request = -1;
44 EXPECT_TRUE(android::traffic_stats::GetTotalTxBytes(&tx_bytes_after_request)); 44 EXPECT_TRUE(android::traffic_stats::GetTotalTxBytes(&tx_bytes_after_request));
45 EXPECT_GT(tx_bytes_after_request, tx_bytes_before_request); 45 EXPECT_GT(tx_bytes_after_request, tx_bytes_before_request);
(...skipping 12 matching lines...) Expand all
58 EXPECT_TRUE( 58 EXPECT_TRUE(
59 android::traffic_stats::GetCurrentUidTxBytes(&tx_bytes_before_request)); 59 android::traffic_stats::GetCurrentUidTxBytes(&tx_bytes_before_request));
60 EXPECT_GE(tx_bytes_before_request, 0); 60 EXPECT_GE(tx_bytes_before_request, 0);
61 EXPECT_TRUE( 61 EXPECT_TRUE(
62 android::traffic_stats::GetCurrentUidRxBytes(&rx_bytes_before_request)); 62 android::traffic_stats::GetCurrentUidRxBytes(&rx_bytes_before_request));
63 EXPECT_GE(rx_bytes_before_request, 0); 63 EXPECT_GE(rx_bytes_before_request, 0);
64 64
65 TestDelegate test_delegate; 65 TestDelegate test_delegate;
66 TestURLRequestContext context(false); 66 TestURLRequestContext context(false);
67 67
68 scoped_ptr<URLRequest> request( 68 std::unique_ptr<URLRequest> request(
69 context.CreateRequest(embedded_test_server.GetURL("/echo.html"), 69 context.CreateRequest(embedded_test_server.GetURL("/echo.html"),
70 DEFAULT_PRIORITY, &test_delegate)); 70 DEFAULT_PRIORITY, &test_delegate));
71 request->Start(); 71 request->Start();
72 base::RunLoop().Run(); 72 base::RunLoop().Run();
73 73
74 // Bytes should increase because of the network traffic. 74 // Bytes should increase because of the network traffic.
75 int64_t tx_bytes_after_request = -1; 75 int64_t tx_bytes_after_request = -1;
76 int64_t rx_bytes_after_request = -1; 76 int64_t rx_bytes_after_request = -1;
77 EXPECT_TRUE( 77 EXPECT_TRUE(
78 android::traffic_stats::GetCurrentUidTxBytes(&tx_bytes_after_request)); 78 android::traffic_stats::GetCurrentUidTxBytes(&tx_bytes_after_request));
79 EXPECT_GT(tx_bytes_after_request, tx_bytes_before_request); 79 EXPECT_GT(tx_bytes_after_request, tx_bytes_before_request);
80 EXPECT_TRUE( 80 EXPECT_TRUE(
81 android::traffic_stats::GetCurrentUidRxBytes(&rx_bytes_after_request)); 81 android::traffic_stats::GetCurrentUidRxBytes(&rx_bytes_after_request));
82 EXPECT_GT(rx_bytes_after_request, rx_bytes_before_request); 82 EXPECT_GT(rx_bytes_after_request, rx_bytes_before_request);
83 } 83 }
84 84
85 } // namespace 85 } // namespace
86 86
87 } // namespace net 87 } // namespace net
OLDNEW
« no previous file with comments | « net/android/network_change_notifier_android_unittest.cc ('k') | net/cert_net/cert_net_fetcher_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698