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

Side by Side Diff: base/win/registry_unittest.cc

Issue 1507413003: clang/win: Let some chromium_code targets build with -Wextra. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: content_browsertests Created 5 years 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
« no previous file with comments | « base/win/iunknown_impl_unittest.cc ('k') | base/win/scoped_bstr_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/win/registry.h" 5 #include "base/win/registry.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 foo_key += L"\\Foo"; 160 foo_key += L"\\Foo";
161 ASSERT_EQ(ERROR_SUCCESS, key.Create(HKEY_CURRENT_USER, foo_key.c_str(), 161 ASSERT_EQ(ERROR_SUCCESS, key.Create(HKEY_CURRENT_USER, foo_key.c_str(),
162 KEY_READ)); 162 KEY_READ));
163 ASSERT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, foo_key.c_str(), 163 ASSERT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, foo_key.c_str(),
164 KEY_READ | KEY_SET_VALUE)); 164 KEY_READ | KEY_SET_VALUE));
165 ASSERT_TRUE(key.Valid()); 165 ASSERT_TRUE(key.Valid());
166 166
167 const wchar_t kName[] = L"name"; 167 const wchar_t kName[] = L"name";
168 // kData size is not a multiple of sizeof(wchar_t). 168 // kData size is not a multiple of sizeof(wchar_t).
169 const uint8 kData[] = { 1, 2, 3, 4, 5 }; 169 const uint8 kData[] = { 1, 2, 3, 4, 5 };
170 EXPECT_EQ(5, arraysize(kData)); 170 EXPECT_EQ(5u, arraysize(kData));
171 ASSERT_EQ(ERROR_SUCCESS, key.WriteValue(kName, kData, 171 ASSERT_EQ(ERROR_SUCCESS, key.WriteValue(kName, kData,
172 arraysize(kData), REG_BINARY)); 172 arraysize(kData), REG_BINARY));
173 173
174 RegistryValueIterator iterator(HKEY_CURRENT_USER, foo_key.c_str()); 174 RegistryValueIterator iterator(HKEY_CURRENT_USER, foo_key.c_str());
175 ASSERT_TRUE(iterator.Valid()); 175 ASSERT_TRUE(iterator.Valid());
176 EXPECT_STREQ(kName, iterator.Name()); 176 EXPECT_STREQ(kName, iterator.Name());
177 // ValueSize() is in bytes. 177 // ValueSize() is in bytes.
178 ASSERT_EQ(arraysize(kData), iterator.ValueSize()); 178 ASSERT_EQ(arraysize(kData), iterator.ValueSize());
179 // Value() is NUL terminated. 179 // Value() is NUL terminated.
180 int end = (iterator.ValueSize() + sizeof(wchar_t) - 1) / sizeof(wchar_t); 180 int end = (iterator.ValueSize() + sizeof(wchar_t) - 1) / sizeof(wchar_t);
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 ASSERT_TRUE(key.StartWatching(Bind(&TestChangeDelegate::OnKeyChanged, 411 ASSERT_TRUE(key.StartWatching(Bind(&TestChangeDelegate::OnKeyChanged,
412 Unretained(&delegate)))); 412 Unretained(&delegate))));
413 base::RunLoop().RunUntilIdle(); 413 base::RunLoop().RunUntilIdle();
414 EXPECT_FALSE(delegate.WasCalled()); 414 EXPECT_FALSE(delegate.WasCalled());
415 } 415 }
416 416
417 } // namespace 417 } // namespace
418 418
419 } // namespace win 419 } // namespace win
420 } // namespace base 420 } // namespace base
OLDNEW
« no previous file with comments | « base/win/iunknown_impl_unittest.cc ('k') | base/win/scoped_bstr_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698