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

Side by Side Diff: remoting/signaling/xmpp_stream_parser_unittest.cc

Issue 2627433003: Remove ScopedVector from remoting/. (Closed)
Patch Set: rev Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "remoting/signaling/xmpp_stream_parser.h" 5 #include "remoting/signaling/xmpp_stream_parser.h"
6 6
7 #include <memory>
7 #include <utility> 8 #include <utility>
9 #include <vector>
8 10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/memory/scoped_vector.h"
11 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h" 13 #include "base/run_loop.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" 15 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
15 16
16 namespace remoting { 17 namespace remoting {
17 18
18 class XmppStreamParserTest : public testing::Test { 19 class XmppStreamParserTest : public testing::Test {
19 public: 20 public:
20 XmppStreamParserTest() : error_(false) {} 21 XmppStreamParserTest() : error_(false) {}
(...skipping 15 matching lines...) Expand all
36 } 37 }
37 38
38 void OnError() { 39 void OnError() {
39 error_ = true; 40 error_ = true;
40 } 41 }
41 42
42 protected: 43 protected:
43 base::MessageLoop message_loop_; 44 base::MessageLoop message_loop_;
44 45
45 std::unique_ptr<XmppStreamParser> parser_; 46 std::unique_ptr<XmppStreamParser> parser_;
46 ScopedVector<buzz::XmlElement> received_stanzas_; 47 std::vector<std::unique_ptr<buzz::XmlElement>> received_stanzas_;
47 bool error_; 48 bool error_;
48 }; 49 };
49 50
50 TEST_F(XmppStreamParserTest, ParseXmppStream) { 51 TEST_F(XmppStreamParserTest, ParseXmppStream) {
51 parser_->AppendData("<stream><iq>text</iq>"); 52 parser_->AppendData("<stream><iq>text</iq>");
52 EXPECT_EQ(received_stanzas_[0]->Str(), "<iq>text</iq>"); 53 EXPECT_EQ(received_stanzas_[0]->Str(), "<iq>text</iq>");
53 }; 54 };
54 55
55 TEST_F(XmppStreamParserTest, HandleMultipleIncomingStanzas) { 56 TEST_F(XmppStreamParserTest, HandleMultipleIncomingStanzas) {
56 parser_->AppendData("<stream><iq>text</iq><iq>more text</iq>"); 57 parser_->AppendData("<stream><iq>text</iq><iq>more text</iq>");
(...skipping 30 matching lines...) Expand all
87 parser_->AppendData("<stream p!='a'>"); 88 parser_->AppendData("<stream p!='a'>");
88 EXPECT_TRUE(error_); 89 EXPECT_TRUE(error_);
89 }; 90 };
90 91
91 TEST_F(XmppStreamParserTest, FailOnLooseText) { 92 TEST_F(XmppStreamParserTest, FailOnLooseText) {
92 parser_->AppendData("stream<"); 93 parser_->AppendData("stream<");
93 EXPECT_TRUE(error_); 94 EXPECT_TRUE(error_);
94 }; 95 };
95 96
96 } // namespace remoting 97 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/signaling/xmpp_signal_strategy_unittest.cc ('k') | remoting/test/test_video_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698