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

Side by Side Diff: chrome/installer/util/package_properties_unittest.cc

Issue 6090006: Regkey functions return error code instead of bool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/logging.h" 5 #include "base/logging.h"
6 #include "base/win/registry.h" 6 #include "base/win/registry.h"
7 #include "chrome/installer/util/google_update_constants.h" 7 #include "chrome/installer/util/google_update_constants.h"
8 #include "chrome/installer/util/package_properties.h" 8 #include "chrome/installer/util/package_properties.h"
9 #include "chrome/installer/util/product_unittest.h" 9 #include "chrome/installer/util/product_unittest.h"
10 #include "chrome/installer/util/util_constants.h" 10 #include "chrome/installer/util/util_constants.h"
(...skipping 17 matching lines...) Expand all
28 std::wstring state_key(props[i]->GetStateKey()); 28 std::wstring state_key(props[i]->GetStateKey());
29 EXPECT_FALSE(state_key.empty()); 29 EXPECT_FALSE(state_key.empty());
30 std::wstring version_key(props[i]->GetVersionKey()); 30 std::wstring version_key(props[i]->GetVersionKey());
31 EXPECT_FALSE(version_key.empty()); 31 EXPECT_FALSE(version_key.empty());
32 if (props[i]->ReceivesUpdates()) { 32 if (props[i]->ReceivesUpdates()) {
33 HKEY roots[] = { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE }; 33 HKEY roots[] = { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE };
34 for (size_t j = 0; j < arraysize(roots); ++j) { 34 for (size_t j = 0; j < arraysize(roots); ++j) {
35 { 35 {
36 TempRegKeyOverride override(roots[j], L"props"); 36 TempRegKeyOverride override(roots[j], L"props");
37 RegKey key; 37 RegKey key;
38 EXPECT_TRUE(key.Create(roots[j], state_key.c_str(), KEY_ALL_ACCESS)); 38 EXPECT_EQ(ERROR_SUCCESS,
39 EXPECT_TRUE(key.WriteValue(google_update::kRegApField, L"")); 39 key.Create(roots[j], state_key.c_str(), KEY_ALL_ACCESS));
40 EXPECT_EQ(ERROR_SUCCESS,
41 key.WriteValue(google_update::kRegApField, L""));
40 props[i]->UpdateDiffInstallStatus(roots[j] == HKEY_LOCAL_MACHINE, 42 props[i]->UpdateDiffInstallStatus(roots[j] == HKEY_LOCAL_MACHINE,
41 true, 43 true,
42 installer::INSTALL_FAILED); 44 installer::INSTALL_FAILED);
43 std::wstring value; 45 std::wstring value;
44 key.ReadValue(google_update::kRegApField, &value); 46 key.ReadValue(google_update::kRegApField, &value);
45 EXPECT_FALSE(value.empty()); 47 EXPECT_FALSE(value.empty());
46 } 48 }
47 TempRegKeyOverride::DeleteAllTempKeys(); 49 TempRegKeyOverride::DeleteAllTempKeys();
48 } 50 }
49 } else { 51 } else {
50 TempRegKeyOverride override(HKEY_CURRENT_USER, L"props"); 52 TempRegKeyOverride override(HKEY_CURRENT_USER, L"props");
51 RegKey key; 53 RegKey key;
52 EXPECT_TRUE(key.Create(HKEY_CURRENT_USER, state_key.c_str(), 54 EXPECT_EQ(ERROR_SUCCESS,
53 KEY_ALL_ACCESS)); 55 key.Create(HKEY_CURRENT_USER, state_key.c_str(), KEY_ALL_ACCESS));
54 } 56 }
55 TempRegKeyOverride::DeleteAllTempKeys(); 57 TempRegKeyOverride::DeleteAllTempKeys();
56 } 58 }
57 } 59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698