OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome_frame/registry_watcher.h" | 5 #include "chrome_frame/registry_watcher.h" |
6 | 6 |
7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
8 #include "base/time.h" | 8 #include "base/time/time.h" |
9 #include "base/win/registry.h" | 9 #include "base/win/registry.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 using base::win::RegKey; | 12 using base::win::RegKey; |
13 | 13 |
14 const wchar_t kTestRoot[] = L"CFRegistryWatcherTest"; | 14 const wchar_t kTestRoot[] = L"CFRegistryWatcherTest"; |
15 const wchar_t kTestWindowClass[] = L"TestWndClass"; | 15 const wchar_t kTestWindowClass[] = L"TestWndClass"; |
16 const wchar_t kTestWindowName[] = L"TestWndName"; | 16 const wchar_t kTestWindowName[] = L"TestWndName"; |
17 | 17 |
18 // Give notifications 30 seconds to stick. Hopefully long enough to avoid | 18 // Give notifications 30 seconds to stick. Hopefully long enough to avoid |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 RegistryWatcher watcher(HKEY_CURRENT_USER, | 63 RegistryWatcher watcher(HKEY_CURRENT_USER, |
64 kTestRoot, | 64 kTestRoot, |
65 &RegistryWatcherUnittest::WaitCallback); | 65 &RegistryWatcherUnittest::WaitCallback); |
66 ASSERT_TRUE(watcher.StartWatching()); | 66 ASSERT_TRUE(watcher.StartWatching()); |
67 EXPECT_EQ(0, reg_change_count_); | 67 EXPECT_EQ(0, reg_change_count_); |
68 | 68 |
69 EXPECT_EQ(ERROR_SUCCESS, temp_key_.CreateKey(L"foo", KEY_ALL_ACCESS)); | 69 EXPECT_EQ(ERROR_SUCCESS, temp_key_.CreateKey(L"foo", KEY_ALL_ACCESS)); |
70 EXPECT_TRUE(event_.TimedWait(base::TimeDelta::FromSeconds(kWaitSeconds))); | 70 EXPECT_TRUE(event_.TimedWait(base::TimeDelta::FromSeconds(kWaitSeconds))); |
71 EXPECT_EQ(1, reg_change_count_); | 71 EXPECT_EQ(1, reg_change_count_); |
72 } | 72 } |
OLD | NEW |