Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: tools/telemetry/telemetry/page/page_run_end_to_end_unittest.py

Issue 802403002: [Telemetry] Fix file naming issue causing page_run_end_to_end tests to never run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/telemetry/telemetry/page/page_run_end_to_end_tests.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import os 5 import os
6 import tempfile 6 import tempfile
7 import unittest 7 import unittest
8 import shutil 8 import shutil
9 import sys 9 import sys
10 import tempfile 10 import tempfile
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 options.suppress_gtest_report = True 300 options.suppress_gtest_report = True
301 SetUpUserStoryRunnerArguments(options) 301 SetUpUserStoryRunnerArguments(options)
302 results = results_options.CreateResults(EmptyMetadataForTest(), options) 302 results = results_options.CreateResults(EmptyMetadataForTest(), options)
303 user_story_runner.Run(test, ps, expectations, options, results) 303 user_story_runner.Run(test, ps, expectations, options, results)
304 304
305 def testRunPageWithStartupUrl(self): 305 def testRunPageWithStartupUrl(self):
306 ps = page_set.PageSet() 306 ps = page_set.PageSet()
307 expectations = test_expectations.TestExpectations() 307 expectations = test_expectations.TestExpectations()
308 expectations = test_expectations.TestExpectations() 308 expectations = test_expectations.TestExpectations()
309 page = page_module.Page( 309 page = page_module.Page(
310 'file://blank.html', ps, base_dir=util.GetUnittestDataDir()) 310 'file://blank.html', ps, base_dir=util.GetUnittestDataDir(),
311 page.startup_url = 'about:blank' 311 startup_url='about:blank')
312 ps.pages.append(page) 312 ps.pages.append(page)
313 313
314 class Measurement(page_test.PageTest): 314 class Measurement(page_test.PageTest):
315 def __init__(self): 315 def __init__(self):
316 super(Measurement, self).__init__() 316 super(Measurement, self).__init__()
317 self.browser_restarted = False 317 self.browser_restarted = False
318 318
319 def CustomizeBrowserOptionsForSinglePage(self, ps, options): 319 def CustomizeBrowserOptionsForSinglePage(self, ps, options):
320 self.browser_restarted = True 320 self.browser_restarted = True
321 super(Measurement, self).CustomizeBrowserOptionsForSinglePage(ps, 321 super(Measurement, self).CustomizeBrowserOptionsForSinglePage(ps,
(...skipping 21 matching lines...) Expand all
343 page = page_module.Page( 343 page = page_module.Page(
344 'file://blank.html', ps, base_dir=util.GetUnittestDataDir()) 344 'file://blank.html', ps, base_dir=util.GetUnittestDataDir())
345 ps.pages.append(page) 345 ps.pages.append(page)
346 346
347 class Test(page_test.PageTest): 347 class Test(page_test.PageTest):
348 def __init__(self): 348 def __init__(self):
349 super(Test, self).__init__() 349 super(Test, self).__init__()
350 self.did_call_clean_up = False 350 self.did_call_clean_up = False
351 351
352 def ValidateAndMeasurePage(self, *_): 352 def ValidateAndMeasurePage(self, *_):
353 raise exceptions.IntentionalException 353 raise page_test.Failure
354 354
355 def CleanUpAfterPage(self, page, tab): 355 def CleanUpAfterPage(self, page, tab):
356 self.did_call_clean_up = True 356 self.did_call_clean_up = True
357 357
358 358
359 test = Test() 359 test = Test()
360 options = options_for_unittests.GetCopy() 360 options = options_for_unittests.GetCopy()
361 options.output_formats = ['none'] 361 options.output_formats = ['none']
362 options.suppress_gtest_report = True 362 options.suppress_gtest_report = True
363 SetUpUserStoryRunnerArguments(options) 363 SetUpUserStoryRunnerArguments(options)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 407
408 def _testMaxFailuresOptionIsRespectedAndOverridable(self, max_failures=None): 408 def _testMaxFailuresOptionIsRespectedAndOverridable(self, max_failures=None):
409 self.SuppressExceptionFormatting() 409 self.SuppressExceptionFormatting()
410 class TestPage(page_module.Page): 410 class TestPage(page_module.Page):
411 def __init__(self, *args, **kwargs): 411 def __init__(self, *args, **kwargs):
412 super(TestPage, self).__init__(*args, **kwargs) 412 super(TestPage, self).__init__(*args, **kwargs)
413 self.was_run = False 413 self.was_run = False
414 414
415 def RunNavigateSteps(self, action_runner): # pylint: disable=W0613 415 def RunNavigateSteps(self, action_runner): # pylint: disable=W0613
416 self.was_run = True 416 self.was_run = True
417 raise Exception('Test exception') 417 raise page_test.Failure
418 418
419 class Test(page_test.PageTest): 419 class Test(page_test.PageTest):
420 def ValidateAndMeasurePage(self, *args): 420 def ValidateAndMeasurePage(self, *args):
421 pass 421 pass
422 422
423 ps = page_set.PageSet() 423 ps = page_set.PageSet()
424 expectations = test_expectations.TestExpectations() 424 expectations = test_expectations.TestExpectations()
425 for ii in range(5): 425 for ii in range(5):
426 ps.pages.append(TestPage( 426 ps.pages.append(TestPage(
427 'file://blank.html', ps, base_dir=util.GetUnittestDataDir())) 427 'file://blank.html', ps, base_dir=util.GetUnittestDataDir()))
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 SetUpUserStoryRunnerArguments(options) 476 SetUpUserStoryRunnerArguments(options)
477 results = results_options.CreateResults(EmptyMetadataForTest(), options) 477 results = results_options.CreateResults(EmptyMetadataForTest(), options)
478 user_story_runner.Run(Measurement(), ps, expectations, options, results) 478 user_story_runner.Run(Measurement(), ps, expectations, options, results)
479 self.assertEquals(1, len(GetSuccessfulPageRuns(results))) 479 self.assertEquals(1, len(GetSuccessfulPageRuns(results)))
480 self.assertEquals(0, len(results.failures)) 480 self.assertEquals(0, len(results.failures))
481 self.assertEquals(0, len(results.all_page_specific_values)) 481 self.assertEquals(0, len(results.all_page_specific_values))
482 self.assertTrue(os.path.isfile( 482 self.assertTrue(os.path.isfile(
483 os.path.join(options.output_dir, 'blank_html.json'))) 483 os.path.join(options.output_dir, 'blank_html.json')))
484 finally: 484 finally:
485 shutil.rmtree(options.output_dir) 485 shutil.rmtree(options.output_dir)
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/page/page_run_end_to_end_tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698