diff options
author | hartmanng@chromium.org <hartmanng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-23 02:29:50 +0000 |
---|---|---|
committer | hartmanng@chromium.org <hartmanng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-23 02:29:50 +0000 |
commit | 59b7899ca2f26f3b3f54c61b61652dd546e93a30 (patch) | |
tree | e66c1633cfbcc792c8c6764e20771827e8ef53bb /tools | |
parent | 7ef7ce1d6b05898b2be3a42800819b7bd4c2dab0 (diff) | |
download | chromium_src-59b7899ca2f26f3b3f54c61b61652dd546e93a30.zip chromium_src-59b7899ca2f26f3b3f54c61b61652dd546e93a30.tar.gz chromium_src-59b7899ca2f26f3b3f54c61b61652dd546e93a30.tar.bz2 |
[Telemetry] Fix slow userAgent unit test in page_runner_unittest.py.
It looks like the IsNavigationDone() condition on tab.Navigate() doesn't work
properly for 'about:blank', so the test was just timing out there.
BUG=170833
Review URL: https://chromiumcodereview.appspot.com/11896042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178212 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r-- | tools/telemetry/telemetry/page_runner_unittest.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/telemetry/telemetry/page_runner_unittest.py b/tools/telemetry/telemetry/page_runner_unittest.py index 39b33b1..aa6c25f 100644 --- a/tools/telemetry/telemetry/page_runner_unittest.py +++ b/tools/telemetry/telemetry/page_runner_unittest.py @@ -1,6 +1,7 @@ # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import os import tempfile import unittest @@ -111,7 +112,9 @@ class PageRunnerTests(unittest.TestCase): return did_run[0] def testUserAgent(self): - page = page_module.Page('about:blank') + page = page_module.Page( + 'file:///' + os.path.join('..', 'unittest_data', 'blank.html'), + base_dir=os.path.dirname(__file__)) ps = page_set.PageSet() ps.pages.append(page) ps.user_agent_type = 'tablet' @@ -122,9 +125,16 @@ class PageRunnerTests(unittest.TestCase): expected_user_agent = user_agent.UA_TYPE_MAPPING['tablet'] assert actual_user_agent.strip() == expected_user_agent + # This is so we can check later that the test actually made it into this + # function. Previously it was timing out before even getting here, which + # should fail, but since it skipped all the asserts, it slipped by. + self.hasRun = True # pylint: disable=W0201 + test = TestUserAgent('RunTest') with page_runner.PageRunner(ps) as runner: options = options_for_unittests.GetCopy() possible_browser = browser_finder.FindBrowser(options) results = page_test.PageTestResults() runner.Run(options, possible_browser, test, results) + + self.assertTrue(hasattr(test, 'hasRun') and test.hasRun) |