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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 tab.Navigate("http://does.not.exist") | 64 tab.Navigate("http://does.not.exist") |
65 tab.WaitForDocumentReadyStateToBeComplete() | 65 tab.WaitForDocumentReadyStateToBeComplete() |
66 | 66 |
67 any_tab = browser.tabs[0] | 67 any_tab = browser.tabs[0] |
68 any_tab.ClearCache(force=True) | 68 any_tab.ClearCache(force=True) |
69 elif temperature == PCV1_WARM: | 69 elif temperature == PCV1_WARM: |
70 if (previous_page is not None and | 70 if (previous_page is not None and |
71 previous_page.url == page.url and | 71 previous_page.url == page.url and |
72 (previous_page.cache_temperature == PCV1_COLD or | 72 (previous_page.cache_temperature == PCV1_COLD or |
73 previous_page.cache_temperature == PCV1_WARM)): | 73 previous_page.cache_temperature == PCV1_WARM)): |
| 74 if '#' in page.url: |
| 75 # Navigate to inexistent URL to avoid in-page hash navigation. |
| 76 # Note: Unlike PCv1, PCv2 iterates the same URL for different cache |
| 77 # configurations. This may issue blink in-page hash navigations, |
| 78 # which isn't intended here. |
| 79 with MarkTelemetryInternal(browser, 'avoid_double_hash_navigation'): |
| 80 tab = browser.tabs[0] |
| 81 tab.Navigate("http://does.not.exist") |
| 82 tab.WaitForDocumentReadyStateToBeComplete() |
74 return | 83 return |
75 | 84 |
76 with MarkTelemetryInternal(browser, 'warmCache'): | 85 with MarkTelemetryInternal(browser, 'warmCache'): |
77 tab = browser.tabs[0] | 86 tab = browser.tabs[0] |
78 tab.Navigate(page.url) | 87 tab.Navigate(page.url) |
79 util.WaitFor(tab.HasReachedQuiescence, 60) | 88 util.WaitFor(tab.HasReachedQuiescence, 60) |
80 tab.WaitForDocumentReadyStateToBeComplete() | 89 tab.WaitForDocumentReadyStateToBeComplete() |
81 tab.Navigate("about:blank") | 90 tab.Navigate("about:blank") |
82 tab.WaitForDocumentReadyStateToBeComplete() | 91 tab.WaitForDocumentReadyStateToBeComplete() |
OLD | NEW |