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

Side by Side Diff: chrome/test/chromedriver/net/websocket_unittest.cc

Issue 1395103003: Don't use base::MessageLoop::{Quit,QuitClosure} in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
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 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 28 matching lines...) Expand all
39 explicit Listener(const std::vector<std::string>& messages) 39 explicit Listener(const std::vector<std::string>& messages)
40 : messages_(messages) {} 40 : messages_(messages) {}
41 41
42 ~Listener() override { EXPECT_TRUE(messages_.empty()); } 42 ~Listener() override { EXPECT_TRUE(messages_.empty()); }
43 43
44 void OnMessageReceived(const std::string& message) override { 44 void OnMessageReceived(const std::string& message) override {
45 ASSERT_TRUE(messages_.size()); 45 ASSERT_TRUE(messages_.size());
46 EXPECT_EQ(messages_[0], message); 46 EXPECT_EQ(messages_[0], message);
47 messages_.erase(messages_.begin()); 47 messages_.erase(messages_.begin());
48 if (messages_.empty()) 48 if (messages_.empty())
49 base::MessageLoop::current()->Quit(); 49 base::MessageLoop::current()->QuitWhenIdle();
50 } 50 }
51 51
52 void OnClose() override { EXPECT_TRUE(false); } 52 void OnClose() override { EXPECT_TRUE(false); }
53 53
54 private: 54 private:
55 std::vector<std::string> messages_; 55 std::vector<std::string> messages_;
56 }; 56 };
57 57
58 class CloseListener : public WebSocketListener { 58 class CloseListener : public WebSocketListener {
59 public: 59 public:
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 SendReceive(messages); 191 SendReceive(messages);
192 } 192 }
193 193
194 TEST_F(WebSocketTest, SendReceiveMultiple) { 194 TEST_F(WebSocketTest, SendReceiveMultiple) {
195 std::vector<std::string> messages; 195 std::vector<std::string> messages;
196 messages.push_back("1"); 196 messages.push_back("1");
197 messages.push_back("2"); 197 messages.push_back("2");
198 messages.push_back("3"); 198 messages.push_back("3");
199 SendReceive(messages); 199 SendReceive(messages);
200 } 200 }
OLDNEW
« no previous file with comments | « chrome/test/base/testing_profile.cc ('k') | chrome/utility/importer/firefox_importer_unittest_utils_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698