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

Side by Side Diff: net/http/http_stream_factory_impl_request_unittest.cc

Issue 2093873002: Unwind fallback metrics and SSLFailureState. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/http/http_stream_factory_impl_request.h" 5 #include "net/http/http_stream_factory_impl_request.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "net/http/http_stream_factory_impl.h" 10 #include "net/http/http_stream_factory_impl.h"
11 #include "net/http/http_stream_factory_impl_job.h" 11 #include "net/http/http_stream_factory_impl_job.h"
12 #include "net/http/http_stream_factory_impl_job_controller.h" 12 #include "net/http/http_stream_factory_impl_job_controller.h"
13 #include "net/http/http_stream_factory_test_util.h" 13 #include "net/http/http_stream_factory_test_util.h"
14 #include "net/proxy/proxy_info.h" 14 #include "net/proxy/proxy_info.h"
15 #include "net/proxy/proxy_service.h" 15 #include "net/proxy/proxy_service.h"
16 #include "net/spdy/spdy_test_util_common.h" 16 #include "net/spdy/spdy_test_util_common.h"
17 #include "net/ssl/ssl_failure_state.h"
18 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
19 18
20 using testing::_; 19 using testing::_;
21 20
22 namespace net { 21 namespace net {
23 22
24 class HttpStreamFactoryImplRequestTest 23 class HttpStreamFactoryImplRequestTest
25 : public ::testing::Test, 24 : public ::testing::Test,
26 public ::testing::WithParamInterface<NextProto> {}; 25 public ::testing::WithParamInterface<NextProto> {};
27 26
(...skipping 21 matching lines...) Expand all
49 std::unique_ptr<HttpStreamFactoryImpl::Request> request( 48 std::unique_ptr<HttpStreamFactoryImpl::Request> request(
50 job_controller->Start(request_info, &request_delegate, nullptr, 49 job_controller->Start(request_info, &request_delegate, nullptr,
51 BoundNetLog(), HttpStreamRequest::HTTP_STREAM, 50 BoundNetLog(), HttpStreamRequest::HTTP_STREAM,
52 DEFAULT_PRIORITY, SSLConfig(), SSLConfig())); 51 DEFAULT_PRIORITY, SSLConfig(), SSLConfig()));
53 EXPECT_TRUE(job_controller->main_job()); 52 EXPECT_TRUE(job_controller->main_job());
54 EXPECT_EQ(DEFAULT_PRIORITY, job_controller->main_job()->priority()); 53 EXPECT_EQ(DEFAULT_PRIORITY, job_controller->main_job()->priority());
55 54
56 request->SetPriority(MEDIUM); 55 request->SetPriority(MEDIUM);
57 EXPECT_EQ(MEDIUM, job_controller->main_job()->priority()); 56 EXPECT_EQ(MEDIUM, job_controller->main_job()->priority());
58 57
59 EXPECT_CALL(request_delegate, OnStreamFailed(_, _, SSL_FAILURE_NONE)) 58 EXPECT_CALL(request_delegate, OnStreamFailed(_, _)).Times(1);
60 .Times(1);
61 job_controller->OnStreamFailed(job_factory.main_job(), ERR_FAILED, 59 job_controller->OnStreamFailed(job_factory.main_job(), ERR_FAILED,
62 SSLConfig(), SSL_FAILURE_NONE); 60 SSLConfig());
63 61
64 request->SetPriority(IDLE); 62 request->SetPriority(IDLE);
65 EXPECT_EQ(IDLE, job_controller->main_job()->priority()); 63 EXPECT_EQ(IDLE, job_controller->main_job()->priority());
66 } 64 }
67 65
68 TEST_P(HttpStreamFactoryImplRequestTest, DelayMainJob) { 66 TEST_P(HttpStreamFactoryImplRequestTest, DelayMainJob) {
69 SpdySessionDependencies session_deps(GetParam(), 67 SpdySessionDependencies session_deps(GetParam(),
70 ProxyService::CreateDirect()); 68 ProxyService::CreateDirect());
71 69
72 std::unique_ptr<HttpNetworkSession> session = 70 std::unique_ptr<HttpNetworkSession> session =
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(wait_time + 1)); 131 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(wait_time + 1));
134 base::RunLoop().RunUntilIdle(); 132 base::RunLoop().RunUntilIdle();
135 133
136 EXPECT_NE(delay, job->wait_time_); 134 EXPECT_NE(delay, job->wait_time_);
137 EXPECT_TRUE(job->wait_time_.is_zero()); 135 EXPECT_TRUE(job->wait_time_.is_zero());
138 EXPECT_EQ(HttpStreamFactoryImpl::Job::STATE_INIT_CONNECTION_COMPLETE, 136 EXPECT_EQ(HttpStreamFactoryImpl::Job::STATE_INIT_CONNECTION_COMPLETE,
139 job->next_state_); 137 job->next_state_);
140 } 138 }
141 139
142 } // namespace net 140 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698