Check temporary zoom status when sending zoom level in navigation.
[chromium-blink-merge.git] / remoting / protocol / network_settings_unittest.cc
blob398d5593909a631a3a7dc801c21d367389d4ab68
1 // Copyright 2014 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.
5 #include "remoting/protocol/network_settings.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 namespace remoting {
10 namespace protocol {
12 TEST(ParsePortRange, Basic) {
13 uint16 min, max;
15 // Valid range
16 EXPECT_TRUE(NetworkSettings::ParsePortRange("1-65535", &min, &max));
17 EXPECT_EQ(1u, min);
18 EXPECT_EQ(65535u, max);
20 EXPECT_TRUE(NetworkSettings::ParsePortRange(" 1 - 65535 ", &min, &max));
21 EXPECT_EQ(1u, min);
22 EXPECT_EQ(65535u, max);
24 EXPECT_TRUE(NetworkSettings::ParsePortRange("12400-12400", &min, &max));
25 EXPECT_EQ(12400u, min);
26 EXPECT_EQ(12400u, max);
28 // Invalid
29 EXPECT_FALSE(NetworkSettings::ParsePortRange("", &min, &max));
30 EXPECT_FALSE(NetworkSettings::ParsePortRange("-65535", &min, &max));
31 EXPECT_FALSE(NetworkSettings::ParsePortRange("1-", &min, &max));
32 EXPECT_FALSE(NetworkSettings::ParsePortRange("-", &min, &max));
33 EXPECT_FALSE(NetworkSettings::ParsePortRange("-1-65535", &min, &max));
34 EXPECT_FALSE(NetworkSettings::ParsePortRange("1--65535", &min, &max));
35 EXPECT_FALSE(NetworkSettings::ParsePortRange("1-65535-", &min, &max));
36 EXPECT_FALSE(NetworkSettings::ParsePortRange("0-65535", &min, &max));
37 EXPECT_FALSE(NetworkSettings::ParsePortRange("1-65536", &min, &max));
38 EXPECT_FALSE(NetworkSettings::ParsePortRange("1-4294967295", &min, &max));
39 EXPECT_FALSE(NetworkSettings::ParsePortRange("10-1", &min, &max));
40 EXPECT_FALSE(NetworkSettings::ParsePortRange("1foo-2bar", &min, &max));
43 } // namespace protocol
44 } // namespace remoting