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

Side by Side Diff: remoting/host/pairing_registry_delegate_win_unittest.cc

Issue 121123002: Update uses of UTF conversions in ppapi/, printing/, remoting/, rlz/, sandbox/, skia/, sql/, sync/,… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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
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"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "base/win/registry.h" 12 #include "base/win/registry.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace remoting { 15 namespace remoting {
16 16
17 using protocol::PairingRegistry; 17 using protocol::PairingRegistry;
18 18
19 class PairingRegistryDelegateWinTest : public testing::Test { 19 class PairingRegistryDelegateWinTest : public testing::Test {
20 public: 20 public:
21 virtual void SetUp() OVERRIDE { 21 virtual void SetUp() OVERRIDE {
22 key_name_ = base::GenerateGUID(); 22 key_name_ = base::GenerateGUID();
23 23
24 base::win::RegKey root; 24 base::win::RegKey root;
25 EXPECT_TRUE(root.Create(HKEY_CURRENT_USER, UTF8ToWide(key_name_).c_str(), 25 EXPECT_TRUE(root.Create(HKEY_CURRENT_USER,
26 base::UTF8ToWide(key_name_).c_str(),
26 KEY_READ | KEY_WRITE) == ERROR_SUCCESS); 27 KEY_READ | KEY_WRITE) == ERROR_SUCCESS);
27 28
28 EXPECT_TRUE(privileged_.Create(root.Handle(), L"privileged", 29 EXPECT_TRUE(privileged_.Create(root.Handle(), L"privileged",
29 KEY_READ | KEY_WRITE) == ERROR_SUCCESS); 30 KEY_READ | KEY_WRITE) == ERROR_SUCCESS);
30 EXPECT_TRUE(unprivileged_.Create(root.Handle(), L"unprivileged", 31 EXPECT_TRUE(unprivileged_.Create(root.Handle(), L"unprivileged",
31 KEY_READ | KEY_WRITE) == ERROR_SUCCESS); 32 KEY_READ | KEY_WRITE) == ERROR_SUCCESS);
32 } 33 }
33 34
34 virtual void TearDown() OVERRIDE { 35 virtual void TearDown() OVERRIDE {
35 privileged_.Close(); 36 privileged_.Close();
36 unprivileged_.Close(); 37 unprivileged_.Close();
37 EXPECT_TRUE(SHDeleteKey(HKEY_CURRENT_USER, 38 EXPECT_TRUE(
38 UTF8ToWide(key_name_).c_str()) == ERROR_SUCCESS); 39 SHDeleteKey(HKEY_CURRENT_USER,
40 base::UTF8ToWide(key_name_).c_str()) == ERROR_SUCCESS);
39 } 41 }
40 42
41 protected: 43 protected:
42 std::string key_name_; 44 std::string key_name_;
43 base::win::RegKey privileged_; 45 base::win::RegKey privileged_;
44 base::win::RegKey unprivileged_; 46 base::win::RegKey unprivileged_;
45 }; 47 };
46 48
47 TEST_F(PairingRegistryDelegateWinTest, SaveAndLoad) { 49 TEST_F(PairingRegistryDelegateWinTest, SaveAndLoad) {
48 scoped_ptr<PairingRegistryDelegateWin> delegate( 50 scoped_ptr<PairingRegistryDelegateWin> delegate(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 EXPECT_EQ(pairing.created_time(), unprivileged_pairing.created_time()); 121 EXPECT_EQ(pairing.created_time(), unprivileged_pairing.created_time());
120 122
121 // Verify that the shared secret if not available. 123 // Verify that the shared secret if not available.
122 EXPECT_TRUE(unprivileged_pairing.shared_secret().empty()); 124 EXPECT_TRUE(unprivileged_pairing.shared_secret().empty());
123 125
124 // Verify that a pairing cannot be saved. 126 // Verify that a pairing cannot be saved.
125 EXPECT_FALSE(delegate->Save(pairing)); 127 EXPECT_FALSE(delegate->Save(pairing));
126 } 128 }
127 129
128 } // namespace remoting 130 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/pairing_registry_delegate_win.cc ('k') | remoting/host/plugin/host_script_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698