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

Side by Side Diff: content/child/resource_dispatcher_unittest.cc

Issue 2303733004: Eliminate spurious request cancelations (Closed)
Patch Set: Fixed dispatcher unit test 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
« no previous file with comments | « content/child/resource_dispatcher.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/child/resource_dispatcher.h" 5 #include "content/child/resource_dispatcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 EXPECT_EQ(0u, queued_messages()); 632 EXPECT_EQ(0u, queued_messages());
633 633
634 // This lets the wrapper peer pass all the messages to the original 634 // This lets the wrapper peer pass all the messages to the original
635 // peer at once, but the original peer cancels right after it receives 635 // peer at once, but the original peer cancels right after it receives
636 // the response. (This will remove pending request info from 636 // the response. (This will remove pending request info from
637 // ResourceDispatcher while the wrapper peer is still running 637 // ResourceDispatcher while the wrapper peer is still running
638 // OnCompletedRequest, but it should not lead to crashes.) 638 // OnCompletedRequest, but it should not lead to crashes.)
639 NotifyRequestComplete(id, strlen(kTestPageContents)); 639 NotifyRequestComplete(id, strlen(kTestPageContents));
640 640
641 EXPECT_TRUE(peer_context.received_response); 641 EXPECT_TRUE(peer_context.received_response);
642 // Request should have been cancelled. 642 // Request should have been cancelled with no additional messages.
643 ConsumeCancelRequest(id); 643 EXPECT_EQ(0u, queued_messages());
644 EXPECT_TRUE(peer_context.cancelled); 644 EXPECT_TRUE(peer_context.cancelled);
645 645
646 // Any future messages related to the request should be ignored. 646 // Any future messages related to the request should be ignored.
647 NotifyDataReceived(id, kTestPageContents); 647 NotifyDataReceived(id, kTestPageContents);
648 NotifyRequestComplete(id, strlen(kTestPageContents)); 648 NotifyRequestComplete(id, strlen(kTestPageContents));
649 649
650 EXPECT_EQ(0u, queued_messages()); 650 EXPECT_EQ(0u, queued_messages());
651 EXPECT_EQ("", peer_context.data); 651 EXPECT_EQ("", peer_context.data);
652 EXPECT_FALSE(peer_context.complete); 652 EXPECT_FALSE(peer_context.complete);
653 } 653 }
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 ResourceResponseHead response_head; 936 ResourceResponseHead response_head;
937 937
938 PerformTest(response_head); 938 PerformTest(response_head);
939 939
940 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); 940 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start);
941 EXPECT_EQ(base::TimeTicks(), 941 EXPECT_EQ(base::TimeTicks(),
942 response_info().load_timing.connect_timing.dns_start); 942 response_info().load_timing.connect_timing.dns_start);
943 } 943 }
944 944
945 } // namespace content 945 } // namespace content
OLDNEW
« no previous file with comments | « content/child/resource_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698