| Index: tools/chrome_remote_control/chrome_remote_control/click_to_navigate_interaction_unittest.py
|
| diff --git a/tools/chrome_remote_control/chrome_remote_control/inspector_console_unittest.py b/tools/chrome_remote_control/chrome_remote_control/click_to_navigate_interaction_unittest.py
|
| similarity index 39%
|
| copy from tools/chrome_remote_control/chrome_remote_control/inspector_console_unittest.py
|
| copy to tools/chrome_remote_control/chrome_remote_control/click_to_navigate_interaction_unittest.py
|
| index 134b250841a261568f487cd7f0aa0b60a35c4df0..5cecd4a2322d97f81cdf76de61856d8842a54840 100644
|
| --- a/tools/chrome_remote_control/chrome_remote_control/inspector_console_unittest.py
|
| +++ b/tools/chrome_remote_control/chrome_remote_control/click_to_navigate_interaction_unittest.py
|
| @@ -2,35 +2,24 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
| import os
|
| -import re
|
| -import StringIO
|
|
|
| +from chrome_remote_control import click_to_navigate_interaction
|
| from chrome_remote_control import tab_test_case
|
| -from chrome_remote_control import util
|
|
|
| -class TabConsoleTest(tab_test_case.TabTestCase):
|
| - def testConsoleOutputStream(self):
|
| +class ClickToNavigateInteractionTest(tab_test_case.TabTestCase):
|
| + def testClickToNavigate(self):
|
| unittest_data_dir = os.path.join(os.path.dirname(__file__),
|
| '..', 'unittest_data')
|
| self._browser.SetHTTPServerDirectory(unittest_data_dir)
|
| -
|
| - stream = StringIO.StringIO()
|
| - self._tab.console.MessageOutputStream = stream
|
| -
|
| self._tab.page.Navigate(
|
| - self._browser.http_server.UrlOf('page_that_logs_to_console.html'))
|
| + self._browser.http_server.UrlOf('page_with_link.html'))
|
| self._tab.WaitForDocumentReadyStateToBeComplete()
|
| + self.assertEquals(self._tab.runtime.Evaluate('document.location.pathname;'),
|
| + '/page_with_link.html')
|
|
|
| - initial = self._tab.runtime.Evaluate('window.__logCount')
|
| - def GotLog():
|
| - current = self._tab.runtime.Evaluate('window.__logCount')
|
| - return current > initial
|
| - util.WaitFor(GotLog, 5)
|
| -
|
| - lines = [l for l in stream.getvalue().split('\n') if len(l)]
|
| -
|
| - self.assertTrue(len(lines) >= 1)
|
| - for l in lines:
|
| - u_l = 'http://localhost:(\d+)/page_that_logs_to_console.html:9'
|
| - self.assertTrue(re.match('At %s: Hello, world' % u_l, l))
|
| + data = {'selector': 'a[id="clickme"]'}
|
| + i = click_to_navigate_interaction.ClickToNavigateInteraction(data)
|
| + i.PerformInteraction({}, self._tab)
|
|
|
| + self.assertEquals(self._tab.runtime.Evaluate('document.location.pathname;'),
|
| + '/blank.html')
|
|
|