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

Unified Diff: remoting/host/pairing_registry_delegate_linux_unittest.cc

Issue 15709005: Linux pairing registry delegate implementation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
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(&registry_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

Powered by Google App Engine
This is Rietveld 408576698