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

Side by Side Diff: chrome/test/mini_installer/process_verifier.py

Issue 2747023002: Cleanup machine based on the state in configuration file for mini installer test.
Patch Set: refactor to use visitor pattern Created 3 years, 9 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
« no previous file with comments | « chrome/test/mini_installer/process.py ('k') | chrome/test/mini_installer/registry.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 chrome_helper
6 import verifier
7
8
9 class ProcessVerifier(verifier.Verifier):
10 """Verifies that the running processes match the expectation dictionaries."""
11
12 def _VerifyExpectation(self, expectation_name, expectation,
13 variable_expander):
14 """Overridden from verifier.Verifier.
15
16 This method will throw an AssertionError if process state doesn't match the
17 |expectation|.
18
19 Args:
20 expectation_name: Path to the process being verified. It is expanded using
21 Expand.
22 expectation: A dictionary with the following key and value:
23 'running' a boolean indicating whether the process should be running.
24 variable_expander: A VariableExpander object.
25 """
26 # Create a list of paths of all running processes.
27 running_process_paths = [path for (_, path) in
28 chrome_helper.GetProcessIDAndPathPairs()]
29 process_path = variable_expander.Expand(expectation_name)
30 is_running = process_path in running_process_paths
31 assert expectation['running'] == is_running, \
32 ('Process %s is running' % process_path) if is_running else \
33 ('Process %s is not running' % process_path)
OLDNEW
« no previous file with comments | « chrome/test/mini_installer/process.py ('k') | chrome/test/mini_installer/registry.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698