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

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

Issue 2464293002: [Chromoting] GetHostAttributes with tests (Closed)
Patch Set: Resolve review comments Created 4 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
OLDNEW
(Empty)
1 // Copyright 2016 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 "remoting/host/host_attributes.h"
6
7 #include <algorithm>
8 #include <vector>
9
10 #include "base/strings/string_split.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace remoting {
14
15 // Ensures there is no DCHECK failure or crash in Register() and Callbacks.
16 TEST(HostAttributesTest, Sanity) {
17 std::string result = GetHostAttributes();
18 #if defined(NDEBUG)
19 ASSERT_EQ(result.find("Debug-Build"), std::string::npos);
20 #else
21 ASSERT_NE(result.find("Debug-Build"), std::string::npos);
22 #endif
23 ASSERT_NE(result.find("Host-Attributes"), std::string::npos);
24 }
25
26 TEST(HostAttributesTest, NoDuplicateKeys) {
27 std::vector<std::string> results = base::SplitString(GetHostAttributes(),
28 ",",
29 base::KEEP_WHITESPACE,
30 base::SPLIT_WANT_ALL);
31 for (auto it = results.begin(); it != results.end(); it++) {
32 ASSERT_EQ(std::find(it + 1, results.end(), *it), results.end());
33 }
34 }
35
36 } // namespace remoting
OLDNEW
« remoting/host/host_attributes.cc ('K') | « remoting/host/host_attributes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698