| Index: remoting/host/pairing_registry_delegate_linux_unittest.cc
|
| diff --git a/remoting/host/pairing_registry_delegate_linux_unittest.cc b/remoting/host/pairing_registry_delegate_linux_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..886d29c8468f627ae01817e078ebfa64c82a07fc
|
| --- /dev/null
|
| +++ b/remoting/host/pairing_registry_delegate_linux_unittest.cc
|
| @@ -0,0 +1,49 @@
|
| +// 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/host/pairing_registry_delegate_linux.h"
|
| +
|
| +#include "base/file_util.h"
|
| +#include "base/task_runner.h"
|
| +#include "testing/gmock/include/gmock/gmock.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +
|
| +namespace remoting {
|
| +namespace protocol {
|
| +
|
| +bool operator==(const PairingRegistry::PairedClients& a,
|
| + const PairingRegistry::PairedClients& b) {
|
| + return a.size() == b.size() && std::equal(a.begin(), a.end(), b.begin());
|
| +}
|
| +
|
| +class PairingRegistryDelegateLinuxTest : public testing::Test {
|
| +};
|
| +
|
| +TEST_F(PairingRegistryDelegateLinuxTest, SaveAndLoad) {
|
| + PairingRegistryDelegateLinux* delegate =
|
| + new PairingRegistryDelegateLinux(scoped_refptr<base::TaskRunner>());
|
| +
|
| + base::FilePath registry_file;
|
| + ASSERT_TRUE(file_util::CreateTemporaryFile(®istry_file));
|
| + delegate->SetFilenameForTesting(registry_file);
|
| +
|
| + PairingRegistry::PairedClients paired_clients;
|
| + PairingRegistry::Pairing pairing = {
|
| + base::Time::Now(),
|
| + "client_id",
|
| + "client_name",
|
| + "shared_secret"
|
| + };
|
| + paired_clients[pairing.client_id] = pairing;
|
| + delegate->SaveOnCurrentThread(paired_clients);
|
| +
|
| + PairingRegistry::PairedClients paired_clients_loaded =
|
| + delegate->LoadOnCurrentThread();
|
| + EXPECT_EQ(paired_clients, paired_clients_loaded);
|
| +
|
| + file_util::Delete(registry_file, false);
|
| +};
|
| +
|
| +} // namespace protocol
|
| +} // namespace remoting
|
|
|