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

Side by Side Diff: base/async_socket_io_handler_unittest.cc

Issue 23058010: Fix namespace for AsyncSocketIoHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/async_socket_io_handler.h" 5 #include "base/async_socket_io_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace { 10 namespace {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 EXPECT_GE(bytes_read, 0); 49 EXPECT_GE(bytes_read, 0);
50 } 50 }
51 ++callbacks_received_; 51 ++callbacks_received_;
52 if (number_of_reads_before_quit_ == callbacks_received_) { 52 if (number_of_reads_before_quit_ == callbacks_received_) {
53 base::MessageLoop::current()->Quit(); 53 base::MessageLoop::current()->Quit();
54 } else if (issue_reads_from_callback_) { 54 } else if (issue_reads_from_callback_) {
55 IssueRead(); 55 IssueRead();
56 } 56 }
57 } 57 }
58 58
59 media::AsyncSocketIoHandler io_handler; 59 base::AsyncSocketIoHandler io_handler;
60 base::CancelableSyncSocket* socket_; // Ownership lies outside the class. 60 base::CancelableSyncSocket* socket_; // Ownership lies outside the class.
61 char buffer_[kAsyncSocketIoTestStringLength]; 61 char buffer_[kAsyncSocketIoTestStringLength];
62 int number_of_reads_before_quit_; 62 int number_of_reads_before_quit_;
63 int callbacks_received_; 63 int callbacks_received_;
64 bool issue_reads_from_callback_; 64 bool issue_reads_from_callback_;
65 bool expect_eof_; 65 bool expect_eof_;
66 }; 66 };
67 67
68 // Workaround to be able to use a base::Closure for sending data. 68 // Workaround to be able to use a base::Closure for sending data.
69 // Send() returns int but a closure must return void. 69 // Send() returns int but a closure must return void.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 const int kReadOperationCount = 1; 160 const int kReadOperationCount = 1;
161 TestSocketReader reader(&pair[0], kReadOperationCount, false, true); 161 TestSocketReader reader(&pair[0], kReadOperationCount, false, true);
162 EXPECT_TRUE(reader.IssueRead()); 162 EXPECT_TRUE(reader.IssueRead());
163 163
164 pair[1].Close(); 164 pair[1].Close();
165 165
166 base::MessageLoop::current()->Run(); 166 base::MessageLoop::current()->Run();
167 EXPECT_EQ(kReadOperationCount, reader.callbacks_received()); 167 EXPECT_EQ(kReadOperationCount, reader.callbacks_received());
168 } 168 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698