Chromium Code Reviews| Index: chrome/test/chromedriver/test/run_py_tests.py |
| diff --git a/chrome/test/chromedriver/test/run_py_tests.py b/chrome/test/chromedriver/test/run_py_tests.py |
| index 2c5e728952ef44f8938b54e24d74f51f13a94c72..c64d862debed30e4ef5c4a167a2191c15796cfab 100755 |
| --- a/chrome/test/chromedriver/test/run_py_tests.py |
| +++ b/chrome/test/chromedriver/test/run_py_tests.py |
| @@ -1836,7 +1836,7 @@ class ChromeLogPathCapabilityTest(ChromeDriverBaseTest): |
| self.assertTrue(self.LOG_MESSAGE in open(tmp_log_path.name).read()) |
| -class MobileEmulationCapabilityTest(ChromeDriverBaseTest): |
| +class MobileEmulationCapabilityTest(ChromeDriverBaseTestWithWebServer): |
| """Tests that ChromeDriver processes chromeOptions.mobileEmulation. |
| Makes sure the device metrics are overridden in DevTools and user agent is |
| @@ -1905,6 +1905,20 @@ class MobileEmulationCapabilityTest(ChromeDriverBaseTest): |
| body_tag = driver.FindElement('tag name', 'body') |
| self.assertEqual("Agent Smith", body_tag.GetText()) |
| + def testUserAgentNewTab(self): |
| + driver = self.CreateDriver( |
| + mobile_emulation = {'userAgent': 'Agent Smith'}) |
| + driver.Load(self.GetHttpUrlForFile('/chromedriver/newtab.html')) |
| + old_windows = driver.GetWindowHandles() |
| + link = driver.FindElements('tag name', 'a')[0] |
| + driver.MouseMoveTo(link) |
| + driver.MouseClick() |
|
stgao
2017/04/05 04:17:08
What's the user-agent if the new tab itself direct
irisu
2017/04/05 06:44:33
Sorry for that misunderstanding. Modified the test
Sami
2017/04/05 13:52:04
Right, looks like we need to support a default use
|
| + new_window = self.WaitForNewWindow(driver, old_windows) |
| + driver.SwitchToWindow(new_window) |
| + driver.Load(self._http_server.GetUrl() + '/userAgent') |
|
stgao
2017/04/05 04:17:08
Before this load, we already instruct the new tab
|
| + body_tag = driver.FindElement('tag name', 'body') |
| + self.assertEqual("Agent Smith", body_tag.GetText()) |
| + |
| def testDeviceName(self): |
| driver = self.CreateDriver( |
| mobile_emulation = {'deviceName': 'Google Nexus 5'}) |