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

Unified Diff: base/win/registry_unittest.cc

Issue 652903005: Revert of Remove raw handles from base::win::RegKey (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « base/win/registry.cc ('k') | content/browser/plugin_service_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/win/registry_unittest.cc
diff --git a/base/win/registry_unittest.cc b/base/win/registry_unittest.cc
index 6548474c4facfca93497d8db149cfd2208b63af0..d2610efd48be372a27ec290174dffbc0cc012354 100644
--- a/base/win/registry_unittest.cc
+++ b/base/win/registry_unittest.cc
@@ -7,10 +7,7 @@
#include <cstring>
#include <vector>
-#include "base/bind.h"
#include "base/compiler_specific.h"
-#include "base/message_loop/message_loop.h"
-#include "base/run_loop.h"
#include "base/stl_util.h"
#include "base/win/windows_version.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -352,68 +349,6 @@
ASSERT_EQ(ERROR_SUCCESS, key.DeleteKey(L"foo"));
}
-class TestChangeDelegate {
- public:
- TestChangeDelegate() : called_(false) {}
- ~TestChangeDelegate() {}
-
- void OnKeyChanged() {
- MessageLoop::current()->QuitWhenIdle();
- called_ = true;
- }
-
- bool WasCalled() {
- bool was_called = called_;
- called_ = false;
- return was_called;
- }
-
- private:
- bool called_;
-};
-
-TEST_F(RegistryTest, ChangeCallback) {
- RegKey key;
- TestChangeDelegate delegate;
- MessageLoop message_loop;
-
- std::wstring foo_key(kRootKey);
- foo_key += L"\\Foo";
- ASSERT_EQ(ERROR_SUCCESS, key.Create(HKEY_CURRENT_USER, foo_key.c_str(),
- KEY_READ));
-
- ASSERT_TRUE(key.StartWatching(Bind(&TestChangeDelegate::OnKeyChanged,
- Unretained(&delegate))));
- EXPECT_FALSE(delegate.WasCalled());
-
- // Make some change.
- RegKey key2;
- ASSERT_EQ(ERROR_SUCCESS, key2.Open(HKEY_CURRENT_USER, foo_key.c_str(),
- KEY_READ | KEY_SET_VALUE));
- ASSERT_TRUE(key2.Valid());
- EXPECT_EQ(ERROR_SUCCESS, key2.WriteValue(L"name", L"data"));
-
- // Allow delivery of the notification.
- EXPECT_FALSE(delegate.WasCalled());
- base::RunLoop().Run();
-
- ASSERT_TRUE(delegate.WasCalled());
- EXPECT_FALSE(delegate.WasCalled());
-
- ASSERT_TRUE(key.StartWatching(Bind(&TestChangeDelegate::OnKeyChanged,
- Unretained(&delegate))));
-
- // Change something else.
- EXPECT_EQ(ERROR_SUCCESS, key2.WriteValue(L"name2", L"data2"));
- base::RunLoop().Run();
- ASSERT_TRUE(delegate.WasCalled());
-
- ASSERT_TRUE(key.StartWatching(Bind(&TestChangeDelegate::OnKeyChanged,
- Unretained(&delegate))));
- base::RunLoop().RunUntilIdle();
- EXPECT_FALSE(delegate.WasCalled());
-}
-
} // namespace
} // namespace win
« no previous file with comments | « base/win/registry.cc ('k') | content/browser/plugin_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698