| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """The testing Environment class. | 5 """The testing Environment class. |
| 6 | 6 |
| 7 It holds the WebsiteTest instances, provides them with credentials, | 7 It holds the WebsiteTest instances, provides them with credentials, |
| 8 provides clean browser environment, runs the tests, and gathers the | 8 provides clean browser environment, runs the tests, and gathers the |
| 9 results. | 9 results. |
| 10 """ | 10 """ |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 # TODO(melandory): We should check why it's off in a first place. | 161 # TODO(melandory): We should check why it's off in a first place. |
| 162 # TODO(melandory): Investigate, maybe there is no need to enable it that | 162 # TODO(melandory): Investigate, maybe there is no need to enable it that |
| 163 # often. | 163 # often. |
| 164 self.driver.get("chrome://settings") | 164 self.driver.get("chrome://settings") |
| 165 self.driver.switch_to_frame("settings") | 165 self.driver.switch_to_frame("settings") |
| 166 script = "document.getElementById('advanced-settings-expander').click();" | 166 script = "document.getElementById('advanced-settings-expander').click();" |
| 167 self.driver.execute_script(script) | 167 self.driver.execute_script(script) |
| 168 # TODO(vabr): Wait until element is displayed instead. | 168 # TODO(vabr): Wait until element is displayed instead. |
| 169 time.sleep(2) | 169 time.sleep(2) |
| 170 script = ( | 170 script = ( |
| 171 "document.querySelector('#password-manager-enabled').checked = true;") | 171 "if (!document.querySelector('#password-manager-enabled').checked) {" |
| 172 " document.querySelector('#password-manager-enabled').click();" |
| 173 "}") |
| 172 self.driver.execute_script(script) | 174 self.driver.execute_script(script) |
| 173 time.sleep(2) | 175 time.sleep(2) |
| 174 | 176 |
| 175 def _OpenNewTab(self): | 177 def _OpenNewTab(self): |
| 176 """Open a new tab, and loads the internals page in the old tab. | 178 """Open a new tab, and loads the internals page in the old tab. |
| 177 | 179 |
| 178 Returns: | 180 Returns: |
| 179 A handle to the new tab. | 181 A handle to the new tab. |
| 180 """ | 182 """ |
| 181 | 183 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 except Exception as e: | 286 except Exception as e: |
| 285 successful = False | 287 successful = False |
| 286 error = e.message | 288 error = e.message |
| 287 self.tests_results.append( | 289 self.tests_results.append( |
| 288 (websitetest.name, test_type, successful, error)) | 290 (websitetest.name, test_type, successful, error)) |
| 289 | 291 |
| 290 def Quit(self): | 292 def Quit(self): |
| 291 """Shuts down the driver.""" | 293 """Shuts down the driver.""" |
| 292 | 294 |
| 293 self.driver.quit() | 295 self.driver.quit() |
| OLD | NEW |