OLD | NEW |
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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_sockets); | 742 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_sockets); |
743 } | 743 } |
744 | 744 |
745 class DataRunnerObserver : public MessageLoop::TaskObserver { | 745 class DataRunnerObserver : public MessageLoop::TaskObserver { |
746 public: | 746 public: |
747 DataRunnerObserver(DeterministicSocketData* data, int run_before_task) | 747 DataRunnerObserver(DeterministicSocketData* data, int run_before_task) |
748 : data_(data), | 748 : data_(data), |
749 run_before_task_(run_before_task), | 749 run_before_task_(run_before_task), |
750 current_task_(0) { } | 750 current_task_(0) { } |
751 | 751 |
752 virtual void WillProcessTask(base::TimeTicks) OVERRIDE { | 752 virtual void WillProcessTask(const base::PendingTask& pending_task) OVERRIDE { |
753 ++current_task_; | 753 ++current_task_; |
754 if (current_task_ == run_before_task_) { | 754 if (current_task_ == run_before_task_) { |
755 data_->Run(); | 755 data_->Run(); |
756 MessageLoop::current()->RemoveTaskObserver(this); | 756 MessageLoop::current()->RemoveTaskObserver(this); |
757 } | 757 } |
758 } | 758 } |
759 | 759 |
760 virtual void DidProcessTask(base::TimeTicks) OVERRIDE { } | 760 virtual void DidProcessTask(const base::PendingTask& pending_task) OVERRIDE {} |
761 | 761 |
762 private: | 762 private: |
763 DeterministicSocketData* data_; | 763 DeterministicSocketData* data_; |
764 int run_before_task_; | 764 int run_before_task_; |
765 int current_task_; | 765 int current_task_; |
766 }; | 766 }; |
767 | 767 |
768 TEST_F(HttpPipelinedNetworkTransactionTest, OpenPipelinesWhileBinding) { | 768 TEST_F(HttpPipelinedNetworkTransactionTest, OpenPipelinesWhileBinding) { |
769 // There was a racy crash in the pipelining code. This test recreates that | 769 // There was a racy crash in the pipelining code. This test recreates that |
770 // race. The steps are: | 770 // race. The steps are: |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 EXPECT_EQ(ERR_PIPELINE_EVICTION, two_callback.WaitForResult()); | 1022 EXPECT_EQ(ERR_PIPELINE_EVICTION, two_callback.WaitForResult()); |
1023 two_transaction.reset(); | 1023 two_transaction.reset(); |
1024 EXPECT_EQ(ERR_PIPELINE_EVICTION, three_callback.WaitForResult()); | 1024 EXPECT_EQ(ERR_PIPELINE_EVICTION, three_callback.WaitForResult()); |
1025 three_transaction.reset(); | 1025 three_transaction.reset(); |
1026 EXPECT_EQ(ERR_PIPELINE_EVICTION, four_callback.WaitForResult()); | 1026 EXPECT_EQ(ERR_PIPELINE_EVICTION, four_callback.WaitForResult()); |
1027 } | 1027 } |
1028 | 1028 |
1029 } // anonymous namespace | 1029 } // anonymous namespace |
1030 | 1030 |
1031 } // namespace net | 1031 } // namespace net |
OLD | NEW |