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

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

Issue 637933002: Replace FINAL and OVERRIDE with their C++11 counterparts in chrome/test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 26 matching lines...) Expand all
37 37
38 class Listener : public WebSocketListener { 38 class Listener : public WebSocketListener {
39 public: 39 public:
40 explicit Listener(const std::vector<std::string>& messages) 40 explicit Listener(const std::vector<std::string>& messages)
41 : messages_(messages) {} 41 : messages_(messages) {}
42 42
43 virtual ~Listener() { 43 virtual ~Listener() {
44 EXPECT_TRUE(messages_.empty()); 44 EXPECT_TRUE(messages_.empty());
45 } 45 }
46 46
47 virtual void OnMessageReceived(const std::string& message) OVERRIDE { 47 virtual void OnMessageReceived(const std::string& message) override {
48 ASSERT_TRUE(messages_.size()); 48 ASSERT_TRUE(messages_.size());
49 EXPECT_EQ(messages_[0], message); 49 EXPECT_EQ(messages_[0], message);
50 messages_.erase(messages_.begin()); 50 messages_.erase(messages_.begin());
51 if (messages_.empty()) 51 if (messages_.empty())
52 base::MessageLoop::current()->Quit(); 52 base::MessageLoop::current()->Quit();
53 } 53 }
54 54
55 virtual void OnClose() OVERRIDE { 55 virtual void OnClose() override {
56 EXPECT_TRUE(false); 56 EXPECT_TRUE(false);
57 } 57 }
58 58
59 private: 59 private:
60 std::vector<std::string> messages_; 60 std::vector<std::string> messages_;
61 }; 61 };
62 62
63 class CloseListener : public WebSocketListener { 63 class CloseListener : public WebSocketListener {
64 public: 64 public:
65 explicit CloseListener(base::RunLoop* run_loop) 65 explicit CloseListener(base::RunLoop* run_loop)
66 : run_loop_(run_loop) {} 66 : run_loop_(run_loop) {}
67 67
68 virtual ~CloseListener() { 68 virtual ~CloseListener() {
69 EXPECT_FALSE(run_loop_); 69 EXPECT_FALSE(run_loop_);
70 } 70 }
71 71
72 virtual void OnMessageReceived(const std::string& message) OVERRIDE {} 72 virtual void OnMessageReceived(const std::string& message) override {}
73 73
74 virtual void OnClose() OVERRIDE { 74 virtual void OnClose() override {
75 EXPECT_TRUE(run_loop_); 75 EXPECT_TRUE(run_loop_);
76 if (run_loop_) 76 if (run_loop_)
77 run_loop_->Quit(); 77 run_loop_->Quit();
78 run_loop_ = NULL; 78 run_loop_ = NULL;
79 } 79 }
80 80
81 private: 81 private:
82 base::RunLoop* run_loop_; 82 base::RunLoop* run_loop_;
83 }; 83 };
84 84
85 class WebSocketTest : public testing::Test { 85 class WebSocketTest : public testing::Test {
86 public: 86 public:
87 WebSocketTest() {} 87 WebSocketTest() {}
88 virtual ~WebSocketTest() {} 88 virtual ~WebSocketTest() {}
89 89
90 virtual void SetUp() OVERRIDE { 90 virtual void SetUp() override {
91 ASSERT_TRUE(server_.Start()); 91 ASSERT_TRUE(server_.Start());
92 } 92 }
93 93
94 virtual void TearDown() OVERRIDE { 94 virtual void TearDown() override {
95 server_.Stop(); 95 server_.Stop();
96 } 96 }
97 97
98 protected: 98 protected:
99 scoped_ptr<WebSocket> CreateWebSocket(const GURL& url, 99 scoped_ptr<WebSocket> CreateWebSocket(const GURL& url,
100 WebSocketListener* listener) { 100 WebSocketListener* listener) {
101 int error; 101 int error;
102 scoped_ptr<WebSocket> sock(new WebSocket(url, listener)); 102 scoped_ptr<WebSocket> sock(new WebSocket(url, listener));
103 base::RunLoop run_loop; 103 base::RunLoop run_loop;
104 sock->Connect(base::Bind(&OnConnectFinished, &run_loop, &error)); 104 sock->Connect(base::Bind(&OnConnectFinished, &run_loop, &error));
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 SendReceive(messages); 206 SendReceive(messages);
207 } 207 }
208 208
209 TEST_F(WebSocketTest, SendReceiveMultiple) { 209 TEST_F(WebSocketTest, SendReceiveMultiple) {
210 std::vector<std::string> messages; 210 std::vector<std::string> messages;
211 messages.push_back("1"); 211 messages.push_back("1");
212 messages.push_back("2"); 212 messages.push_back("2");
213 messages.push_back("3"); 213 messages.push_back("3");
214 SendReceive(messages); 214 SendReceive(messages);
215 } 215 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/net/url_request_context_getter.h ('k') | chrome/test/chromedriver/performance_logger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698