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

Side by Side Diff: chrome/test/mini_installer/process.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
OLDNEW
(Empty)
1 # Copyright 2017 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 entry
7
8 class Process(entry.Entry):
9 """ Visitor for Processes entry in property.
10 """
11 def __init__(self, variable_expander, visitor):
12 super(Process, self).__init__(variable_expander, visitor)
13 self.process_path = None
14 self.is_running = None
15 self.should_process_run = None
16
17 def Check(self, entry_name, entry_value):
18 """ Check whether a process is running or not.
19
20 Args:
21 'entry_name' - A string represents the path to the process being
22 verified.
23 'entry_value' - A dictionary with the following key and value:
24 'running': a boolean indicating whether the process
25 should be running.
26 """
27 running_process_paths = [path for (_, path) in
28 chrome_helper.GetProcessIDAndPathPairs()]
29 self.process_path = self._variable_expander.Expand(entry_name)
30 self.is_running = self.process_path in running_process_paths
31 self.should_process_run = entry_value['running']
32 self._visitor.VisitProcess(self)
OLDNEW
« no previous file with comments | « chrome/test/mini_installer/mini_installer_test.gni ('k') | chrome/test/mini_installer/process_verifier.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698