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

Side by Side Diff: components/domain_reliability/monitor_unittest.cc

Issue 2336043007: Domain Reliability: Don't crash on shutdown with uploads pending (Closed)
Patch Set: Initialize new raw pointer. Created 4 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/domain_reliability/monitor.h" 5 #include "components/domain_reliability/monitor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 time_(new MockTime()), 61 time_(new MockTime()),
62 monitor_("test-reporter", 62 monitor_("test-reporter",
63 pref_task_runner_, 63 pref_task_runner_,
64 network_task_runner_, 64 network_task_runner_,
65 std::unique_ptr<MockableTime>(time_)) { 65 std::unique_ptr<MockableTime>(time_)) {
66 monitor_.MoveToNetworkThread(); 66 monitor_.MoveToNetworkThread();
67 monitor_.InitURLRequestContext(url_request_context_getter_); 67 monitor_.InitURLRequestContext(url_request_context_getter_);
68 monitor_.SetDiscardUploads(false); 68 monitor_.SetDiscardUploads(false);
69 } 69 }
70 70
71 ~DomainReliabilityMonitorTest() override {
72 monitor_.Shutdown();
73 }
74
71 static RequestInfo MakeRequestInfo() { 75 static RequestInfo MakeRequestInfo() {
72 RequestInfo request; 76 RequestInfo request;
73 request.status = net::URLRequestStatus(); 77 request.status = net::URLRequestStatus();
74 request.response_info.socket_address = 78 request.response_info.socket_address =
75 net::HostPortPair::FromString("12.34.56.78:80"); 79 net::HostPortPair::FromString("12.34.56.78:80");
76 request.response_info.headers = MakeHttpResponseHeaders( 80 request.response_info.headers = MakeHttpResponseHeaders(
77 "HTTP/1.1 200 OK\n\n"); 81 "HTTP/1.1 200 OK\n\n");
78 request.response_info.was_cached = false; 82 request.response_info.was_cached = false;
79 request.response_info.network_accessed = true; 83 request.response_info.network_accessed = true;
80 request.response_info.was_fetched_via_proxy = false; 84 request.response_info.was_fetched_via_proxy = false;
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 request.status = net::URLRequestStatus::FromError(net::ERR_CONNECTION_RESET); 433 request.status = net::URLRequestStatus::FromError(net::ERR_CONNECTION_RESET);
430 OnRequestLegComplete(request); 434 OnRequestLegComplete(request);
431 435
432 EXPECT_EQ(1u, CountQueuedBeacons(context1)); 436 EXPECT_EQ(1u, CountQueuedBeacons(context1));
433 EXPECT_EQ(0u, CountQueuedBeacons(context2)); 437 EXPECT_EQ(0u, CountQueuedBeacons(context2));
434 } 438 }
435 439
436 } // namespace 440 } // namespace
437 441
438 } // namespace domain_reliability 442 } // namespace domain_reliability
OLDNEW
« components/domain_reliability/monitor.cc ('K') | « components/domain_reliability/monitor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698