OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Controller objects that control the context in which chrome runs. | 5 """Controller objects that control the context in which chrome runs. |
6 | 6 |
7 This is responsible for the setup necessary for launching chrome, and for | 7 This is responsible for the setup necessary for launching chrome, and for |
8 creating a DevToolsConnection. There are remote device and local | 8 creating a DevToolsConnection. There are remote device and local |
9 desktop-specific versions. | 9 desktop-specific versions. |
10 """ | 10 """ |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 headless: true if the chrome instance should be headless. | 310 headless: true if the chrome instance should be headless. |
311 """ | 311 """ |
312 self._headless = headless | 312 self._headless = headless |
313 | 313 |
314 @contextlib.contextmanager | 314 @contextlib.contextmanager |
315 def OpenWithRedirection(self, stdout, stderr): | 315 def OpenWithRedirection(self, stdout, stderr): |
316 """Override for connection context. stdout and stderr are passed to the | 316 """Override for connection context. stdout and stderr are passed to the |
317 child processes used to run Chrome and XVFB.""" | 317 child processes used to run Chrome and XVFB.""" |
318 chrome_cmd = [OPTIONS.local_binary] | 318 chrome_cmd = [OPTIONS.local_binary] |
319 chrome_cmd.extend(self._GetChromeArguments()) | 319 chrome_cmd.extend(self._GetChromeArguments()) |
| 320 # Force use of simple cache. |
| 321 chrome_cmd.append('--use-simple-cache-backend=on') |
320 chrome_cmd.append('--user-data-dir=%s' % self._profile_dir) | 322 chrome_cmd.append('--user-data-dir=%s' % self._profile_dir) |
321 chrome_cmd.extend(['--enable-logging=stderr', '--v=1']) | 323 chrome_cmd.extend(['--enable-logging=stderr', '--v=1']) |
322 # Navigates to about:blank for couples of reasons: | 324 # Navigates to about:blank for couples of reasons: |
323 # - To find the correct target descriptor at devtool connection; | 325 # - To find the correct target descriptor at devtool connection; |
324 # - To avoid cache and WPR pollution by the NTP. | 326 # - To avoid cache and WPR pollution by the NTP. |
325 chrome_cmd.append('about:blank') | 327 chrome_cmd.append('about:blank') |
326 | 328 |
327 chrome_env_override = {} | 329 chrome_env_override = {} |
328 if self._wpr_attributes: | 330 if self._wpr_attributes: |
329 chrome_env_override.update(self._wpr_attributes.chrome_env_override) | 331 chrome_env_override.update(self._wpr_attributes.chrome_env_override) |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 os.listdir(self._profile_dir) == []): | 422 os.listdir(self._profile_dir) == []): |
421 # Launch chrome so that it populates the profile directory. | 423 # Launch chrome so that it populates the profile directory. |
422 with self.Open(): | 424 with self.Open(): |
423 pass | 425 pass |
424 print os.listdir(self._profile_dir + '/Default') | 426 print os.listdir(self._profile_dir + '/Default') |
425 assert os.path.isdir(self._profile_dir) | 427 assert os.path.isdir(self._profile_dir) |
426 assert os.path.isdir(os.path.dirname(self._GetCacheDirectoryPath())) | 428 assert os.path.isdir(os.path.dirname(self._GetCacheDirectoryPath())) |
427 | 429 |
428 def _GetCacheDirectoryPath(self): | 430 def _GetCacheDirectoryPath(self): |
429 return os.path.join(self._profile_dir, 'Default', 'Cache') | 431 return os.path.join(self._profile_dir, 'Default', 'Cache') |
OLD | NEW |