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

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 if VerifyRegistryEntry(key, entry):
12 print "Passed"
gab 2013/08/01 20:30:41 Add TODO to use unittest framework instead of prin
sukolsak 2013/08/02 22:59:55 Done.
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")
gab 2013/08/01 20:30:41 Add TODO to use unittest framework here.
sukolsak 2013/08/02 22:59:55 Done.
27
28
29 def VerifyRegistryEntry(key, entry):
30 expected = entry["expected"]
31 print settings.PRINT_VERIFIER_PREFIX + key,
gab 2013/08/01 20:30:41 Add TODO to remove these prints, i.e.: # TODO(suk
sukolsak 2013/08/02 22:59:55 Done.
32 if expected:
33 print "exists...",
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)
40 if not expected:
41 return False
gab 2013/08/01 20:30:41 Add a comment that the code should only continue i
sukolsak 2013/08/02 22:59:55 Fixed by reducing the scope of try/except to the O
42 if "value" in entry:
43 # TODO(sukolsak): implement value
44 pass
45 return True
46 except WindowsError:
47 return not expected
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698