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

Side by Side Diff: remoting/base/capabilities_unittest.cc

Issue 428403003: Some tiny cleanups. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/host/client_session_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "remoting/base/capabilities.h" 9 #include "remoting/base/capabilities.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 { "a b c", "z", false } 58 { "a b c", "z", false }
59 }; 59 };
60 60
61 // Verify that HasCapability(|capabilities|, |key|) returns |result|. 61 // Verify that HasCapability(|capabilities|, |key|) returns |result|.
62 // |result|. 62 // |result|.
63 for (size_t i = 0; i < arraysize(data); ++i) { 63 for (size_t i = 0; i < arraysize(data); ++i) {
64 std::vector<std::string> caps; 64 std::vector<std::string> caps;
65 Tokenize(data[i].capabilities, " ", &caps); 65 Tokenize(data[i].capabilities, " ", &caps);
66 66
67 do { 67 do {
68 EXPECT_EQ(HasCapability(JoinString(caps, " "), data[i].key), 68 EXPECT_EQ(data[i].result,
69 data[i].result); 69 HasCapability(JoinString(caps, " "), data[i].key));
70 } while (std::next_permutation(caps.begin(), caps.end())); 70 } while (std::next_permutation(caps.begin(), caps.end()));
71 } 71 }
72 } 72 }
73 73
74 TEST(CapabilitiesTest, Intersect) { 74 TEST(CapabilitiesTest, Intersect) {
75 EXPECT_EQ(IntersectCapabilities("a", "a"), "a"); 75 EXPECT_EQ(IntersectCapabilities("a", "a"), "a");
76 76
77 IntersectTestData data[] = { 77 IntersectTestData data[] = {
78 { "", "", "" }, 78 { "", "", "" },
79 { "a", "", "" }, 79 { "a", "", "" },
(...skipping 10 matching lines...) Expand all
90 { "a b c", "z", "" } 90 { "a b c", "z", "" }
91 }; 91 };
92 92
93 // Verify that intersection of |right| with all permutations of |left| yields 93 // Verify that intersection of |right| with all permutations of |left| yields
94 // |result|. 94 // |result|.
95 for (size_t i = 0; i < arraysize(data); ++i) { 95 for (size_t i = 0; i < arraysize(data); ++i) {
96 std::vector<std::string> caps; 96 std::vector<std::string> caps;
97 Tokenize(data[i].left, " ", &caps); 97 Tokenize(data[i].left, " ", &caps);
98 98
99 do { 99 do {
100 EXPECT_EQ(IntersectCapabilities(JoinString(caps, " "), data[i].right), 100 EXPECT_EQ(data[i].result,
101 data[i].result); 101 IntersectCapabilities(JoinString(caps, " "), data[i].right));
102 } while (std::next_permutation(caps.begin(), caps.end())); 102 } while (std::next_permutation(caps.begin(), caps.end()));
103 } 103 }
104 } 104 }
105 105
106 } // namespace remoting 106 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/host/client_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698