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

Side by Side Diff: chrome/test/mini_installer_test/registry_verifier.py

Issue 20578004: Initial commit for the Automated Installer Testing Framework. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 4 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
OLDNEW
(Empty)
1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import _winreg
6 import settings
7
8
9 def VerifyRegistryEntries(entries):
10 for key, entry in entries.iteritems():
11 if VerifyRegistryEntry(key, entry):
12 print "Passed"
13 else:
14 print "Failed"
15
16
17 def RootKeyConstant(key):
18 if key == "HKEY_CLASSES_ROOT":
19 return _winreg.HKEY_CLASSES_ROOT
20 if key == "HKEY_CURRENT_USER":
21 return _winreg.HKEY_CURRENT_USER
22 if key == "HKEY_LOCAL_MACHINE":
23 return _winreg.HKEY_LOCAL_MACHINE
24 if key == "HKEY_USERS":
25 return _winreg.HKEY_USERS
26 raise Exception("Unknown registry key")
27
28
29 def VerifyRegistryEntry(key, entry):
30 expected = entry["expected"]
gab 2013/07/31 13:45:16 Does this raise an exception if "expected" hasn't
sukolsak 2013/07/31 18:20:30 Python will raise the KeyError exception when the
31 print settings.PRINT_VERIFIER_PREFIX + key,
32 if expected:
33 print "exists...",
gab 2013/07/31 13:45:16 Don't these prints need the PRINT_VERIFIER_PREFIX
sukolsak 2013/07/31 18:20:30 No. I want it to be on the same line. The output w
gab 2013/08/01 20:30:41 Ah ok my bad, assumed print forced an automatic ne
34 else:
35 print "doesn't exist...",
36 try:
37 root_key, sub_key = key.split("\\", 1)
38 reg_key = _winreg.OpenKey(RootKeyConstant(root_key),
39 sub_key, 0, _winreg.KEY_READ)
gab 2013/07/31 13:45:16 Indent to delimiter ('(') or 4 spaces in, not a mi
sukolsak 2013/07/31 18:20:30 Done.
40 if expected == False:
gab 2013/07/31 13:45:16 Doesn't if !expected work here?
sukolsak 2013/07/31 18:20:30 Done.
41 return False
42 if "value" in entry:
43 # TODO(sukolsak): implement value
44 pass
45 return True
46 except WindowsError:
47 return expected == False
gab 2013/07/31 13:45:16 !expected ? I don't know python much, can we not
sukolsak 2013/07/31 18:20:30 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698