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

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_TRUE(result.find("Debug-Build") == std::string::npos);
20 #else
21 ASSERT_TRUE(result.find("Debug-Build") != std::string::npos);
22 #endif
23 }
24
25 TEST(HostAttributesTest, NoDuplicateKeys) {
26 std::vector<std::string> results = base::SplitString(GetHostAttributes(),
27 ",",
28 base::KEEP_WHITESPACE,
29 base::SPLIT_WANT_ALL);
30 for (auto it = results.begin(); it != results.end(); it++) {
31 ASSERT_EQ(std::find(it + 1, results.end(), *it), results.end());
32 }
33 }
34
35 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698