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

Side by Side Diff: chrome/test/mini_installer/file.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/entry.py ('k') | chrome/test/mini_installer/file_verifier.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 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 os
6
7 import entry
8
9 class File(entry.Entry):
10 """ Handle file property in state.
11 """
12 def __init__(self, variable_expander, visitor):
13 super(File, self).__init__(variable_expander, visitor)
14 self.file_path = None
15 self.is_file_existed = None
16 self.should_file_exist = None
17
18 def Check(self, entry_name, entry_value):
19 """ Check whether a file is existed or not.
20
21 Args:
22 'entry_name' - A string represents the path to the file being
23 verified.
24 'entry_value' - A dictionary with the following key and value:
25 'exists': a boolean indicating whether the file should
26 exist.
27 """
28 self.file_path = self._variable_expander.Expand(entry_name)
29 self.is_file_existed = os.path.exists(self.file_path)
30 self.should_file_exist = entry_value['exists']
31 self._visitor.VisitFile(self)
OLDNEW
« no previous file with comments | « chrome/test/mini_installer/entry.py ('k') | chrome/test/mini_installer/file_verifier.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698