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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 2447083003: Move fail on suspend logic from URLRequestJob to TcpClientSocket.
Patch Set: Fix connect error case Created 4 years, 1 month 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 <utility> 6 #include <utility>
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 2981 matching lines...) Expand 10 before | Expand all | Expand 10 after
2992 2992
2993 EXPECT_NE(d.data_received().find("secure-origin=1"), std::string::npos); 2993 EXPECT_NE(d.data_received().find("secure-origin=1"), std::string::npos);
2994 EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); 2994 EXPECT_EQ(0, network_delegate.blocked_get_cookies_count());
2995 EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); 2995 EXPECT_EQ(0, network_delegate.blocked_set_cookie_count());
2996 } 2996 }
2997 } 2997 }
2998 2998
2999 // Tests that a request is cancelled while entering suspend mode. Uses mocks 2999 // Tests that a request is cancelled while entering suspend mode. Uses mocks
3000 // rather than a spawned test server because the connection used to talk to 3000 // rather than a spawned test server because the connection used to talk to
3001 // the test server is affected by entering suspend mode on Android. 3001 // the test server is affected by entering suspend mode on Android.
3002 TEST_F(URLRequestTest, CancelOnSuspend) { 3002 TEST_F(URLRequestTest, DISABLED_CancelOnSuspend) {
3003 TestPowerMonitorSource* power_monitor_source = new TestPowerMonitorSource(); 3003 TestPowerMonitorSource* power_monitor_source = new TestPowerMonitorSource();
3004 base::PowerMonitor power_monitor(base::WrapUnique(power_monitor_source)); 3004 base::PowerMonitor power_monitor(base::WrapUnique(power_monitor_source));
3005 3005
3006 URLRequestFailedJob::AddUrlHandler(); 3006 URLRequestFailedJob::AddUrlHandler();
3007 3007
3008 TestDelegate d; 3008 TestDelegate d;
3009 // Request that just hangs. 3009 // Request that just hangs.
3010 GURL url(URLRequestFailedJob::GetMockHttpUrl(ERR_IO_PENDING)); 3010 GURL url(URLRequestFailedJob::GetMockHttpUrl(ERR_IO_PENDING));
3011 std::unique_ptr<URLRequest> r( 3011 std::unique_ptr<URLRequest> r(
3012 default_context_.CreateRequest(url, DEFAULT_PRIORITY, &d)); 3012 default_context_.CreateRequest(url, DEFAULT_PRIORITY, &d));
(...skipping 7205 matching lines...) Expand 10 before | Expand all | Expand 10 after
10218 AddTestInterceptor()->set_main_intercept_job(std::move(job)); 10218 AddTestInterceptor()->set_main_intercept_job(std::move(job));
10219 10219
10220 req->Start(); 10220 req->Start();
10221 req->Cancel(); 10221 req->Cancel();
10222 base::RunLoop().RunUntilIdle(); 10222 base::RunLoop().RunUntilIdle();
10223 EXPECT_EQ(ERR_ABORTED, d.request_status()); 10223 EXPECT_EQ(ERR_ABORTED, d.request_status());
10224 EXPECT_EQ(0, d.received_redirect_count()); 10224 EXPECT_EQ(0, d.received_redirect_count());
10225 } 10225 }
10226 10226
10227 } // namespace net 10227 } // namespace net
OLDNEW
« net/socket/stream_socket.h ('K') | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698