OLD | NEW |
(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 } |
| 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 |
OLD | NEW |