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 """ | 5 """ |
6 Cache temperature specifies how the browser cache should be configured before | 6 Cache temperature specifies how the browser cache should be configured before |
7 the page run. | 7 the page run. |
8 | 8 |
9 See design doc for details: | 9 See design doc for details: |
10 https://docs.google.com/document/u/1/d/12D7tkhZi887g9d0U2askU9JypU_wYiEI7Lw0bfwx
UgA | 10 https://docs.google.com/document/u/1/d/12D7tkhZi887g9d0U2askU9JypU_wYiEI7Lw0bfwx
UgA |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 if temperature == ANY: | 61 if temperature == ANY: |
62 return | 62 return |
63 | 63 |
64 if temperature == COLD: | 64 if temperature == COLD: |
65 if previous_page is None: | 65 if previous_page is None: |
66 with MarkTelemetryInternal(browser, 'ensure_diskcache'): | 66 with MarkTelemetryInternal(browser, 'ensure_diskcache'): |
67 tab = browser.tabs[0] | 67 tab = browser.tabs[0] |
68 tab.Navigate("http://does.not.exist") | 68 tab.Navigate("http://does.not.exist") |
69 tab.WaitForDocumentReadyStateToBeComplete() | 69 tab.WaitForDocumentReadyStateToBeComplete() |
70 | |
71 any_tab = browser.tabs[0] | 70 any_tab = browser.tabs[0] |
72 any_tab.ClearCache(force=True) | 71 any_tab.ClearCache(force=True) |
73 elif temperature == WARM: | 72 elif temperature == WARM: |
74 if (previous_page is not None and | 73 if (previous_page is not None and |
75 previous_page.url == page.url and | 74 previous_page.url == page.url and |
76 (previous_page.cache_temperature == COLD or | 75 (previous_page.cache_temperature == COLD or |
77 previous_page.cache_temperature == WARM)): | 76 previous_page.cache_temperature == WARM)): |
78 if '#' in page.url: | 77 if '#' in page.url: |
79 # Navigate to inexistent URL to avoid in-page hash navigation. | 78 # Navigate to inexistent URL to avoid in-page hash navigation. |
80 # Note: Unlike PCv1, PCv2 iterates the same URL for different cache | 79 # Note: Unlike PCv1, PCv2 iterates the same URL for different cache |
81 # configurations. This may issue blink in-page hash navigations, | 80 # configurations. This may issue blink in-page hash navigations, |
82 # which isn't intended here. | 81 # which isn't intended here. |
83 with MarkTelemetryInternal(browser, 'avoid_double_hash_navigation'): | 82 with MarkTelemetryInternal(browser, 'avoid_double_hash_navigation'): |
84 tab = browser.tabs[0] | 83 tab = browser.tabs[0] |
85 tab.Navigate("http://does.not.exist") | 84 tab.Navigate("http://does.not.exist") |
86 tab.WaitForDocumentReadyStateToBeComplete() | 85 tab.WaitForDocumentReadyStateToBeComplete() |
87 return | 86 return |
88 | 87 |
89 with MarkTelemetryInternal(browser, 'warmCache'): | 88 with MarkTelemetryInternal(browser, 'warm_cache'): |
90 tab = browser.tabs[0] | 89 tab = browser.tabs[0] |
91 tab.Navigate(page.url) | 90 tab.Navigate(page.url) |
92 py_utils.WaitFor(tab.HasReachedQuiescence, 60) | 91 py_utils.WaitFor(tab.HasReachedQuiescence, 60) |
93 tab.WaitForDocumentReadyStateToBeComplete() | 92 tab.WaitForDocumentReadyStateToBeComplete() |
94 tab.Navigate("about:blank") | 93 tab.Navigate("about:blank") |
95 tab.WaitForDocumentReadyStateToBeComplete() | 94 tab.WaitForDocumentReadyStateToBeComplete() |
OLD | NEW |