OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/linux/certificate_watcher.h" | 5 #include "remoting/host/linux/certificate_watcher.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
12 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
13 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 | 16 |
16 namespace remoting { | 17 namespace remoting { |
17 | 18 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 std::string testWriteString = std::to_string(rand()); | 84 std::string testWriteString = std::to_string(rand()); |
84 | 85 |
85 base::WriteFile(watch_path_, testWriteString.c_str(), | 86 base::WriteFile(watch_path_, testWriteString.c_str(), |
86 testWriteString.length()); | 87 testWriteString.length()); |
87 } | 88 } |
88 | 89 |
89 base::MessageLoopForIO message_loop_; | 90 base::MessageLoopForIO message_loop_; |
90 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 91 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
91 base::ScopedTempDir temp_dir_; | 92 base::ScopedTempDir temp_dir_; |
92 base::FilePath watch_path_; | 93 base::FilePath watch_path_; |
93 scoped_ptr<CertificateWatcher> watcher_; | 94 std::unique_ptr<CertificateWatcher> watcher_; |
94 int restart_count_ = 0; | 95 int restart_count_ = 0; |
95 base::TimeDelta loop_wait_ = | 96 base::TimeDelta loop_wait_ = |
96 base::TimeDelta::FromMilliseconds(kMessageLoopWaitMsecs); | 97 base::TimeDelta::FromMilliseconds(kMessageLoopWaitMsecs); |
97 base::Closure quit_loop_closure_; | 98 base::Closure quit_loop_closure_; |
98 | 99 |
99 private: | 100 private: |
100 const base::FilePath& CreateAndGetUniqueTempDir() { | 101 const base::FilePath& CreateAndGetUniqueTempDir() { |
101 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); | 102 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); |
102 return temp_dir_.path(); | 103 return temp_dir_.path(); |
103 } | 104 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 EXPECT_EQ(0, restart_count_); | 138 EXPECT_EQ(0, restart_count_); |
138 Disconnect(); | 139 Disconnect(); |
139 RunAndWait(); | 140 RunAndWait(); |
140 EXPECT_EQ(0, restart_count_); | 141 EXPECT_EQ(0, restart_count_); |
141 TouchFile(); | 142 TouchFile(); |
142 RunLoop(); | 143 RunLoop(); |
143 EXPECT_EQ(1, restart_count_); | 144 EXPECT_EQ(1, restart_count_); |
144 } | 145 } |
145 | 146 |
146 } // namespace remoting | 147 } // namespace remoting |
OLD | NEW |