| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import multiprocessing | 4 import multiprocessing |
| 5 import os | 5 import os |
| 6 import sqlite3 | 6 |
| 7 try: |
| 8 import sqlite3 # Not present on ChromeOS DUT. |
| 9 except ImportError: |
| 10 pass |
| 7 | 11 |
| 8 import page_sets | 12 import page_sets |
| 9 | 13 |
| 10 from profile_creators import fast_navigation_profile_extender | 14 from profile_creators import fast_navigation_profile_extender |
| 11 | 15 |
| 12 class CookieProfileExtender( | 16 class CookieProfileExtender( |
| 13 fast_navigation_profile_extender.FastNavigationProfileExtender): | 17 fast_navigation_profile_extender.FastNavigationProfileExtender): |
| 14 """This extender fills in the cookie database. | 18 """This extender fills in the cookie database. |
| 15 | 19 |
| 16 By default, Chrome purges the cookie DB down to 3300 cookies. However, it | 20 By default, Chrome purges the cookie DB down to 3300 cookies. However, it |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 that this method will return a false negative.""" | 82 that this method will return a false negative.""" |
| 79 cookie_db_path = os.path.join(self.profile_path, "Default", "Cookies") | 83 cookie_db_path = os.path.join(self.profile_path, "Default", "Cookies") |
| 80 try: | 84 try: |
| 81 cookie_count = CookieProfileExtender._CookieCountInDB(cookie_db_path) | 85 cookie_count = CookieProfileExtender._CookieCountInDB(cookie_db_path) |
| 82 except sqlite3.OperationalError: | 86 except sqlite3.OperationalError: |
| 83 # There will occasionally be contention for the SQLite database. This | 87 # There will occasionally be contention for the SQLite database. This |
| 84 # shouldn't happen often, so ignore the errors. | 88 # shouldn't happen often, so ignore the errors. |
| 85 return False | 89 return False |
| 86 | 90 |
| 87 return cookie_count > CookieProfileExtender._COOKIE_DB_EXPECTED_SIZE | 91 return cookie_count > CookieProfileExtender._COOKIE_DB_EXPECTED_SIZE |
| OLD | NEW |