OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 "remoting/host/host_session_options.h" | 5 #include "remoting/host/host_session_options.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace remoting { | 9 namespace remoting { |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 HostSessionOptions options; | 44 HostSessionOptions options; |
45 options.Import("A:,B:,C:D,E:V"); | 45 options.Import("A:,B:,C:D,E:V"); |
46 std::string result = options.Export(); | 46 std::string result = options.Export(); |
47 | 47 |
48 HostSessionOptions other; | 48 HostSessionOptions other; |
49 other.Append("C", "X"); | 49 other.Append("C", "X"); |
50 other.Import(result); | 50 other.Import(result); |
51 ASSERT_EQ(options.Export(), other.Export()); | 51 ASSERT_EQ(options.Export(), other.Export()); |
52 } | 52 } |
53 | 53 |
| 54 TEST(HostSessionOptionsTest, ShouldBeAbleToGetBool) { |
| 55 HostSessionOptions options; |
| 56 options.Import("A:,B:x,C:true,D:TRUE,E:1,F:2"); |
| 57 ASSERT_TRUE(*options.GetBool("A")); |
| 58 ASSERT_FALSE(*options.GetBool("B")); |
| 59 ASSERT_TRUE(*options.GetBool("C")); |
| 60 ASSERT_TRUE(*options.GetBool("D")); |
| 61 ASSERT_TRUE(*options.GetBool("E")); |
| 62 ASSERT_FALSE(*options.GetBool("F")); |
| 63 ASSERT_FALSE(options.GetBool("G")); |
| 64 } |
| 65 |
| 66 TEST(HostSessionOptionsTest, ShouldBeAbleToGetInt) { |
| 67 HostSessionOptions options; |
| 68 options.Import("A:100,B:-200,C:x,D:"); |
| 69 ASSERT_EQ(*options.GetInt("A"), 100); |
| 70 ASSERT_EQ(*options.GetInt("B"), -200); |
| 71 ASSERT_FALSE(options.GetInt("C")); |
| 72 ASSERT_FALSE(options.GetInt("D")); |
| 73 } |
| 74 |
54 } // namespace remoting | 75 } // namespace remoting |
OLD | NEW |