| OLD | NEW |
| 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 "remoting/host/pairing_registry_delegate_win.h" | 5 #include "remoting/host/pairing_registry_delegate_win.h" |
| 6 | 6 |
| 7 #include <shlwapi.h> | 7 #include <shlwapi.h> |
| 8 | 8 |
| 9 #include "base/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 new PairingRegistryDelegateWin()); | 105 new PairingRegistryDelegateWin()); |
| 106 delegate->SetRootKeys(privileged_.Handle(), unprivileged_.Handle()); | 106 delegate->SetRootKeys(privileged_.Handle(), unprivileged_.Handle()); |
| 107 | 107 |
| 108 PairingRegistry::Pairing pairing(base::Time::Now(), "xxx", "xxx", "xxx"); | 108 PairingRegistry::Pairing pairing(base::Time::Now(), "xxx", "xxx", "xxx"); |
| 109 EXPECT_TRUE(delegate->Save(pairing)); | 109 EXPECT_TRUE(delegate->Save(pairing)); |
| 110 EXPECT_EQ(delegate->Load(pairing.client_id()), pairing); | 110 EXPECT_EQ(delegate->Load(pairing.client_id()), pairing); |
| 111 | 111 |
| 112 // Strip the delegate from write access and validate that it still can be used | 112 // Strip the delegate from write access and validate that it still can be used |
| 113 // to read the pairings. | 113 // to read the pairings. |
| 114 delegate.reset(new PairingRegistryDelegateWin()); | 114 delegate.reset(new PairingRegistryDelegateWin()); |
| 115 delegate->SetRootKeys(NULL, unprivileged_.Handle()); | 115 delegate->SetRootKeys(nullptr, unprivileged_.Handle()); |
| 116 | 116 |
| 117 PairingRegistry::Pairing unprivileged_pairing = | 117 PairingRegistry::Pairing unprivileged_pairing = |
| 118 delegate->Load(pairing.client_id()); | 118 delegate->Load(pairing.client_id()); |
| 119 EXPECT_EQ(pairing.client_id(), unprivileged_pairing.client_id()); | 119 EXPECT_EQ(pairing.client_id(), unprivileged_pairing.client_id()); |
| 120 EXPECT_EQ(pairing.client_name(), unprivileged_pairing.client_name()); | 120 EXPECT_EQ(pairing.client_name(), unprivileged_pairing.client_name()); |
| 121 EXPECT_EQ(pairing.created_time(), unprivileged_pairing.created_time()); | 121 EXPECT_EQ(pairing.created_time(), unprivileged_pairing.created_time()); |
| 122 | 122 |
| 123 // Verify that the shared secret if not available. | 123 // Verify that the shared secret if not available. |
| 124 EXPECT_TRUE(unprivileged_pairing.shared_secret().empty()); | 124 EXPECT_TRUE(unprivileged_pairing.shared_secret().empty()); |
| 125 | 125 |
| 126 // Verify that a pairing cannot be saved. | 126 // Verify that a pairing cannot be saved. |
| 127 EXPECT_FALSE(delegate->Save(pairing)); | 127 EXPECT_FALSE(delegate->Save(pairing)); |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace remoting | 130 } // namespace remoting |
| OLD | NEW |