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

Side by Side 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, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "remoting/host/pairing_registry_delegate_linux.h"
6
7 #include "base/file_util.h"
8 #include "base/task_runner.h"
9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace remoting {
13 namespace protocol {
14
15 bool operator==(const PairingRegistry::PairedClients& a,
16 const PairingRegistry::PairedClients& b) {
17 return a.size() == b.size() && std::equal(a.begin(), a.end(), b.begin());
18 }
19
20 class PairingRegistryDelegateLinuxTest : public testing::Test {
21 };
22
23 TEST_F(PairingRegistryDelegateLinuxTest, SaveAndLoad) {
24 PairingRegistryDelegateLinux* delegate =
25 new PairingRegistryDelegateLinux(scoped_refptr<base::TaskRunner>());
26
27 base::FilePath registry_file;
28 ASSERT_TRUE(file_util::CreateTemporaryFile(&registry_file));
29 delegate->SetFilenameForTesting(registry_file);
30
31 PairingRegistry::PairedClients paired_clients;
32 PairingRegistry::Pairing pairing = {
33 base::Time::Now(),
34 "client_id",
35 "client_name",
36 "shared_secret"
37 };
38 paired_clients[pairing.client_id] = pairing;
39 delegate->SaveOnCurrentThread(paired_clients);
40
41 PairingRegistry::PairedClients paired_clients_loaded =
42 delegate->LoadOnCurrentThread();
43 EXPECT_EQ(paired_clients, paired_clients_loaded);
44
45 file_util::Delete(registry_file, false);
46 };
47
48 } // namespace protocol
49 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698