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

Side by Side Diff: net/quic/chromium/quic_network_transaction_unittest.cc

Issue 2833983002: Test network annotation tags added to unittests in net/. (Closed)
Patch Set: One file moved. Created 3 years, 7 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 <memory> 5 #include <memory>
6 #include <ostream> 6 #include <ostream>
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "net/socket/next_proto.h" 59 #include "net/socket/next_proto.h"
60 #include "net/socket/socket_performance_watcher.h" 60 #include "net/socket/socket_performance_watcher.h"
61 #include "net/socket/socket_performance_watcher_factory.h" 61 #include "net/socket/socket_performance_watcher_factory.h"
62 #include "net/socket/socket_test_util.h" 62 #include "net/socket/socket_test_util.h"
63 #include "net/spdy/core/spdy_frame_builder.h" 63 #include "net/spdy/core/spdy_frame_builder.h"
64 #include "net/spdy/core/spdy_framer.h" 64 #include "net/spdy/core/spdy_framer.h"
65 #include "net/ssl/ssl_config_service_defaults.h" 65 #include "net/ssl/ssl_config_service_defaults.h"
66 #include "net/test/cert_test_util.h" 66 #include "net/test/cert_test_util.h"
67 #include "net/test/gtest_util.h" 67 #include "net/test/gtest_util.h"
68 #include "net/test/test_data_directory.h" 68 #include "net/test/test_data_directory.h"
69 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
69 #include "net/url_request/url_request.h" 70 #include "net/url_request/url_request.h"
70 #include "net/url_request/url_request_job_factory_impl.h" 71 #include "net/url_request/url_request_job_factory_impl.h"
71 #include "net/url_request/url_request_test_util.h" 72 #include "net/url_request/url_request_test_util.h"
72 #include "testing/gmock/include/gmock/gmock.h" 73 #include "testing/gmock/include/gmock/gmock.h"
73 #include "testing/gtest/include/gtest/gtest.h" 74 #include "testing/gtest/include/gtest/gtest.h"
74 #include "testing/platform_test.h" 75 #include "testing/platform_test.h"
75 #include "url/gurl.h" 76 #include "url/gurl.h"
76 77
77 namespace net { 78 namespace net {
78 namespace test { 79 namespace test {
(...skipping 3947 matching lines...) Expand 10 before | Expand all | Expand 10 after
4026 TestDelegate delegate; 4027 TestDelegate delegate;
4027 QuicURLRequestContext quic_url_request_context(std::move(session_), 4028 QuicURLRequestContext quic_url_request_context(std::move(session_),
4028 &socket_factory_); 4029 &socket_factory_);
4029 4030
4030 mock_quic_data.AddSocketDataToFactory( 4031 mock_quic_data.AddSocketDataToFactory(
4031 &quic_url_request_context.socket_factory()); 4032 &quic_url_request_context.socket_factory());
4032 TestNetworkDelegate network_delegate; 4033 TestNetworkDelegate network_delegate;
4033 quic_url_request_context.set_network_delegate(&network_delegate); 4034 quic_url_request_context.set_network_delegate(&network_delegate);
4034 4035
4035 std::unique_ptr<URLRequest> request(quic_url_request_context.CreateRequest( 4036 std::unique_ptr<URLRequest> request(quic_url_request_context.CreateRequest(
4036 GURL("https://mail.example.org/"), DEFAULT_PRIORITY, &delegate)); 4037 GURL("https://mail.example.org/"), DEFAULT_PRIORITY, &delegate,
4038 TRAFFIC_ANNOTATION_FOR_TESTS));
4037 quic_url_request_context.socket_factory().AddSSLSocketDataProvider( 4039 quic_url_request_context.socket_factory().AddSSLSocketDataProvider(
4038 &ssl_data_); 4040 &ssl_data_);
4039 4041
4040 request->Start(); 4042 request->Start();
4041 base::RunLoop().Run(); 4043 base::RunLoop().Run();
4042 4044
4043 EXPECT_LT(0, request->GetTotalSentBytes()); 4045 EXPECT_LT(0, request->GetTotalSentBytes());
4044 EXPECT_LT(0, request->GetTotalReceivedBytes()); 4046 EXPECT_LT(0, request->GetTotalReceivedBytes());
4045 EXPECT_EQ(network_delegate.total_network_bytes_sent(), 4047 EXPECT_EQ(network_delegate.total_network_bytes_sent(),
4046 request->GetTotalSentBytes()); 4048 request->GetTotalSentBytes());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
4101 TestDelegate delegate; 4103 TestDelegate delegate;
4102 QuicURLRequestContext quic_url_request_context(std::move(session_), 4104 QuicURLRequestContext quic_url_request_context(std::move(session_),
4103 &socket_factory_); 4105 &socket_factory_);
4104 4106
4105 mock_quic_data.AddSocketDataToFactory( 4107 mock_quic_data.AddSocketDataToFactory(
4106 &quic_url_request_context.socket_factory()); 4108 &quic_url_request_context.socket_factory());
4107 TestNetworkDelegate network_delegate; 4109 TestNetworkDelegate network_delegate;
4108 quic_url_request_context.set_network_delegate(&network_delegate); 4110 quic_url_request_context.set_network_delegate(&network_delegate);
4109 4111
4110 std::unique_ptr<URLRequest> request(quic_url_request_context.CreateRequest( 4112 std::unique_ptr<URLRequest> request(quic_url_request_context.CreateRequest(
4111 GURL("https://mail.example.org/"), DEFAULT_PRIORITY, &delegate)); 4113 GURL("https://mail.example.org/"), DEFAULT_PRIORITY, &delegate,
4114 TRAFFIC_ANNOTATION_FOR_TESTS));
4112 quic_url_request_context.socket_factory().AddSSLSocketDataProvider( 4115 quic_url_request_context.socket_factory().AddSSLSocketDataProvider(
4113 &ssl_data_); 4116 &ssl_data_);
4114 4117
4115 request->Start(); 4118 request->Start();
4116 base::RunLoop().Run(); 4119 base::RunLoop().Run();
4117 4120
4118 EXPECT_LT(0, request->GetTotalSentBytes()); 4121 EXPECT_LT(0, request->GetTotalSentBytes());
4119 EXPECT_LT(0, request->GetTotalReceivedBytes()); 4122 EXPECT_LT(0, request->GetTotalReceivedBytes());
4120 EXPECT_EQ(network_delegate.total_network_bytes_sent(), 4123 EXPECT_EQ(network_delegate.total_network_bytes_sent(),
4121 request->GetTotalSentBytes()); 4124 request->GetTotalSentBytes());
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
4620 4623
4621 request_.url = GURL("https://mail.example.org/pushed.jpg"); 4624 request_.url = GURL("https://mail.example.org/pushed.jpg");
4622 ChunkedUploadDataStream upload_data(0); 4625 ChunkedUploadDataStream upload_data(0);
4623 upload_data.AppendData("1", 1, true); 4626 upload_data.AppendData("1", 1, true);
4624 request_.upload_data_stream = &upload_data; 4627 request_.upload_data_stream = &upload_data;
4625 SendRequestAndExpectQuicResponse("and hello!"); 4628 SendRequestAndExpectQuicResponse("and hello!");
4626 } 4629 }
4627 4630
4628 } // namespace test 4631 } // namespace test
4629 } // namespace net 4632 } // namespace net
OLDNEW
« no previous file with comments | « net/nqe/throughput_analyzer_unittest.cc ('k') | net/spdy/chromium/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698