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

Side by Side Diff: chrome/test/mini_installer/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 # TODO(sukolsak): Use unittest framework instead of prints.
12 if VerifyRegistryEntry(key, entry):
13 print "Passed"
14 else:
15 print "Failed"
16
17
18 def RootKeyConstant(key):
19 if key == "HKEY_CLASSES_ROOT":
20 return _winreg.HKEY_CLASSES_ROOT
21 if key == "HKEY_CURRENT_USER":
22 return _winreg.HKEY_CURRENT_USER
23 if key == "HKEY_LOCAL_MACHINE":
24 return _winreg.HKEY_LOCAL_MACHINE
25 if key == "HKEY_USERS":
26 return _winreg.HKEY_USERS
27 # TODO(sukolsak: Use unittest framework instead of exceptions.
28 raise Exception("Unknown registry key")
29
30
31 def VerifyRegistryEntry(key, entry):
32 expected = entry["expected"]
33 # TODO(sukolsak): Debug prints to be removed later.
34 print settings.PRINT_VERIFIER_PREFIX + key,
35 if expected:
36 print "exists...",
37 else:
38 print "doesn't exist...",
39 root_key, sub_key = key.split("\\", 1)
40 try:
41 reg_key = _winreg.OpenKey(RootKeyConstant(root_key),
42 sub_key, 0, _winreg.KEY_READ)
43 except WindowsError:
44 return not expected
45 if not expected:
46 return False
47 if "value" in entry:
48 # TODO(sukolsak): implement value
49 pass
50 return True
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698