OLD | NEW |
(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) |
OLD | NEW |