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

Unified Diff: remoting/base/capabilities_unittest.cc

Issue 13932020: Set the initial resolution of an RDP session to the client screen resolution if it is available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed remoting_unittests Created 7 years, 8 months 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
Index: remoting/base/capabilities_unittest.cc
diff --git a/remoting/base/capabilities_unittest.cc b/remoting/base/capabilities_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6ae3fc823b3be4df11856848c7015cec7eb259fc
--- /dev/null
+++ b/remoting/base/capabilities_unittest.cc
@@ -0,0 +1,48 @@
+// Copyright 2013 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/base/capabilities.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace remoting {
+
+TEST(CapabilitiesTest, Empty) {
+ // Expect that nothing can be found in an empty set.
+ EXPECT_FALSE(HasCapability("", "a"));
+ EXPECT_FALSE(HasCapability(" ", "a"));
+ EXPECT_FALSE(HasCapability(" ", "a"));
+
+ // Expect that nothing can be found in an empty set, event when the key is
+ // empty.
+ EXPECT_FALSE(HasCapability("", ""));
+ EXPECT_FALSE(HasCapability(" ", ""));
+ EXPECT_FALSE(HasCapability(" ", ""));
+
+ // Intersection with an empty set given an empty set.
+ EXPECT_EQ(IntersectCapabilities("", ""), "");
+ EXPECT_EQ(IntersectCapabilities(" ", ""), "");
+ EXPECT_EQ(IntersectCapabilities("a", ""), "");
+ EXPECT_EQ(IntersectCapabilities("", " "), "");
+ EXPECT_EQ(IntersectCapabilities(" ", " "), "");
+ EXPECT_EQ(IntersectCapabilities("a", " "), "");
+ EXPECT_EQ(IntersectCapabilities("", "a"), "");
+ EXPECT_EQ(IntersectCapabilities(" ", "a"), "");
+}
+
+TEST(CapabilitiesTest, HasCapability) {
+ EXPECT_TRUE(HasCapability("a", "a"));
+ EXPECT_TRUE(HasCapability("a a", "a"));
+ EXPECT_TRUE(HasCapability("a b", "a"));
+ EXPECT_FALSE(HasCapability("a", "b"));
+ EXPECT_FALSE(HasCapability("a a", "b"));
+ EXPECT_TRUE(HasCapability("a b", "b"));
+}
+
+TEST(CapabilitiesTest, Intersect) {
+ EXPECT_EQ(IntersectCapabilities("a", "a"), "a");
+ EXPECT_EQ(IntersectCapabilities("a b", "a"), "a");
+ EXPECT_EQ(IntersectCapabilities("a b", "b"), "b");
Sergey Ulanov 2013/04/18 00:34:53 Please add more complex tests, e.g. when the eleme
alexeypa (please no reviews) 2013/04/18 18:56:36 Done.
+}
+
+} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698