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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/host_attributes.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/host_attributes_unittest.cc
diff --git a/remoting/host/host_attributes_unittest.cc b/remoting/host/host_attributes_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e8514d27bdfe7cb529705b9f4dfc09b3df13e8e7
--- /dev/null
+++ b/remoting/host/host_attributes_unittest.cc
@@ -0,0 +1,35 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/host/host_attributes.h"
+
+#include <algorithm>
+#include <vector>
+
+#include "base/strings/string_split.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace remoting {
+
+// Ensures there is no DCHECK failure or crash in Register() and Callbacks.
+TEST(HostAttributesTest, Sanity) {
+ std::string result = GetHostAttributes();
+#if defined(NDEBUG)
+ ASSERT_EQ(result.find("Debug-Build"), std::string::npos);
+#else
+ ASSERT_NE(result.find("Debug-Build"), std::string::npos);
+#endif
+}
+
+TEST(HostAttributesTest, NoDuplicateKeys) {
+ std::vector<std::string> results = base::SplitString(GetHostAttributes(),
+ ",",
+ base::KEEP_WHITESPACE,
+ base::SPLIT_WANT_ALL);
+ for (auto it = results.begin(); it != results.end(); it++) {
+ ASSERT_EQ(std::find(it + 1, results.end(), *it), results.end());
+ }
+}
+
+} // namespace remoting
« no previous file with comments | « remoting/host/host_attributes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698