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

Side by Side Diff: net/http/http_pipelined_connection_impl_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
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 "net/http/http_pipelined_connection_impl.h" 5 #include "net/http/http_pipelined_connection_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 HttpPipelinedConnection::Feedback feedback)); 74 HttpPipelinedConnection::Feedback feedback));
75 }; 75 };
76 76
77 class SuddenCloseObserver : public MessageLoop::TaskObserver { 77 class SuddenCloseObserver : public MessageLoop::TaskObserver {
78 public: 78 public:
79 SuddenCloseObserver(HttpStream* stream, int close_before_task) 79 SuddenCloseObserver(HttpStream* stream, int close_before_task)
80 : stream_(stream), 80 : stream_(stream),
81 close_before_task_(close_before_task), 81 close_before_task_(close_before_task),
82 current_task_(0) { } 82 current_task_(0) { }
83 83
84 virtual void WillProcessTask(base::TimeTicks) OVERRIDE { 84 virtual void WillProcessTask(const base::PendingTask& pending_task) OVERRIDE {
85 ++current_task_; 85 ++current_task_;
86 if (current_task_ == close_before_task_) { 86 if (current_task_ == close_before_task_) {
87 stream_->Close(false); 87 stream_->Close(false);
88 MessageLoop::current()->RemoveTaskObserver(this); 88 MessageLoop::current()->RemoveTaskObserver(this);
89 } 89 }
90 } 90 }
91 91
92 virtual void DidProcessTask(base::TimeTicks) OVERRIDE { } 92 virtual void DidProcessTask(const base::PendingTask& pending_task) OVERRIDE {}
93 93
94 private: 94 private:
95 HttpStream* stream_; 95 HttpStream* stream_;
96 int close_before_task_; 96 int close_before_task_;
97 int current_task_; 97 int current_task_;
98 }; 98 };
99 99
100 class HttpPipelinedConnectionImplTest : public testing::Test { 100 class HttpPipelinedConnectionImplTest : public testing::Test {
101 public: 101 public:
102 HttpPipelinedConnectionImplTest() 102 HttpPipelinedConnectionImplTest()
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 MessageLoop::current()->RunUntilIdle(); 1597 MessageLoop::current()->RunUntilIdle();
1598 1598
1599 stream->Close(false); 1599 stream->Close(false);
1600 EXPECT_CALL(delegate_, OnPipelineHasCapacity(pipeline_.get())).Times(1); 1600 EXPECT_CALL(delegate_, OnPipelineHasCapacity(pipeline_.get())).Times(1);
1601 stream.reset(NULL); 1601 stream.reset(NULL);
1602 } 1602 }
1603 1603
1604 } // anonymous namespace 1604 } // anonymous namespace
1605 1605
1606 } // namespace net 1606 } // namespace net
OLDNEW
« no previous file with comments | « media/audio/mac/audio_device_listener_mac.cc ('k') | net/http/http_pipelined_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698