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

Side by Side Diff: remoting/host/server_log_entry_unittest.cc

Issue 8468015: The host sends simple log entries to the server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac trybot. Created 9 years, 1 month 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/memory/scoped_ptr.h"
6 #include "remoting/host/server_log_entry.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
9
10 using buzz::XmlAttr;
11 using buzz::XmlElement;
12
13 namespace remoting {
14
15 class ServerLogEntryTest : public testing::Test {
16 protected:
17 static int countAttrs(XmlElement* elem) {
Sergey Ulanov 2011/11/17 01:16:33 CountAttrs?
simonmorris 2011/11/18 19:23:04 Removed altogether.
18 int n = 0;
19 XmlAttr* attr = elem->FirstAttr();
20 while (attr != NULL) {
21 attr = attr->NextAttr();
22 n++;
23 }
24 return n;
25 }
26 };
27
28 TEST_F(ServerLogEntryTest, MakeSessionStateChange) {
29 scoped_ptr<ServerLogEntry> entry(
30 ServerLogEntry::MakeSessionStateChange(true));
31 scoped_ptr<XmlElement> stanza(entry->ToStanza());
32 ASSERT_EQ(3, ServerLogEntryTest::countAttrs(stanza.get()));
33 }
34
35 TEST_F(ServerLogEntryTest, AddHostFields) {
36 scoped_ptr<ServerLogEntry> entry(
37 ServerLogEntry::MakeSessionStateChange(true));
38 entry->AddHostFields();
39 scoped_ptr<XmlElement> stanza(entry->ToStanza());
40
41 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
42 int expected = 6;
43 #else
44 int expected = 5;
45 #endif
46
47 ASSERT_EQ(expected, ServerLogEntryTest::countAttrs(stanza.get()));
Sergey Ulanov 2011/11/17 01:16:33 In protocol/jingle_messages_unittests.cc there is
simonmorris 2011/11/18 19:23:04 Done (something similar).
48 }
49
50 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698