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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/mini_installer/process.py
diff --git a/chrome/test/mini_installer/process.py b/chrome/test/mini_installer/process.py
new file mode 100644
index 0000000000000000000000000000000000000000..bef2000222d47c0dbe822f2123d8edf045619918
--- /dev/null
+++ b/chrome/test/mini_installer/process.py
@@ -0,0 +1,32 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import chrome_helper
+import entry
+
+class Process(entry.Entry):
+ """ Visitor for Processes entry in property.
+ """
+ def __init__(self, variable_expander, visitor):
+ super(Process, self).__init__(variable_expander, visitor)
+ self.process_path = None
+ self.is_running = None
+ self.should_process_run = None
+
+ def Check(self, entry_name, entry_value):
+ """ Check whether a process is running or not.
+
+ Args:
+ 'entry_name' - A string represents the path to the process being
+ verified.
+ 'entry_value' - A dictionary with the following key and value:
+ 'running': a boolean indicating whether the process
+ should be running.
+ """
+ running_process_paths = [path for (_, path) in
+ chrome_helper.GetProcessIDAndPathPairs()]
+ self.process_path = self._variable_expander.Expand(entry_name)
+ self.is_running = self.process_path in running_process_paths
+ self.should_process_run = entry_value['running']
+ self._visitor.VisitProcess(self)
« 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