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

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

Issue 12161002: MessageLoop's RUN method will pass a const ref to PendingTask when (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_pipelined_connection_impl_unittest.cc ('k') | webkit/glue/webthread_impl.cc » ('j') | 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 <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
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
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
OLDNEW
« no previous file with comments | « net/http/http_pipelined_connection_impl_unittest.cc ('k') | webkit/glue/webthread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698