def testConstrainedNetworkPerf(self):
        """Starts CNS, spins up worker threads to run through _TEST_CONSTRAINTS."""
        # Run a dummy test to avoid Chrome/CNS startup overhead.
        logging.debug(
            'Starting a dummy test to avoid Chrome/CNS startup overhead.')
        self._RunDummyTest(_TEST_HTML_PATH)
        logging.debug('Dummy test has finished. Starting real perf tests.')

        # Spin up CNS worker threads.
        tasks = cns_test_base.CreateCNSPerfTasks(_TESTS_TO_RUN, _TEST_VIDEOS)
        worker_thread.RunWorkerThreads(self, CNSWorkerThread, tasks,
                                       _TEST_THREADS, _TEST_HTML_PATH)
    def _RunDummyTest(self, test_path):
        """Runs a dummy test with high bandwidth and no latency or packet loss.

    Fails the unit test if the dummy test does not end.

    Args:
      test_path: Path to HTML/JavaScript test code.
    """
        tasks = Queue.Queue()
        tasks.put(('Dummy Test', [5000, 0, 0], (_TEST_MEDIA_EPP[0], True)))
        # Dummy test should successfully finish by passing all the tests.
        if worker_thread.RunWorkerThreads(self, CNSWorkerThread, tasks, 1,
                                          test_path):
            self.fail('Failed to run dummy test.')
    def testConstrainedNetworkPerf(self):
        """Starts CNS, spins up worker threads to run through _TEST_CONSTRAINTS."""
        # Run a dummy test to avoid Chrome/CNS startup overhead.
        logging.debug(
            'Starting a dummy test to avoid Chrome/CNS startup overhead.')
        self._RunDummyTest(_TEST_HTML_PATH)
        logging.debug('Dummy test has finished. Starting real perf tests.')

        # Tests that wait for EPP metrics.
        media_files = [(name, True) for name in _TEST_MEDIA_EPP]
        media_files.extend((name, False) for name in _TEST_MEDIA_NO_EPP)
        tasks = cns_test_base.CreateCNSPerfTasks(_TESTS_TO_RUN, media_files)
        if worker_thread.RunWorkerThreads(self, CNSWorkerThread, tasks,
                                          _TEST_THREADS, _TEST_HTML_PATH):
            self.fail('Some tests failed to run as expected.')
예제 #4
0
 def testMediaSeekPerformance(self):
     """Launches HTML test which plays each video and records seek stats."""
     tasks = cns_test_base.CreateCNSPerfTasks(_TESTS_TO_RUN, _TEST_VIDEOS)
     if worker_thread.RunWorkerThreads(self, SeekWorkerThread, tasks,
                                       _TEST_THREADS, _TEST_HTML_PATH):
         self.fail('Some tests failed to run as expected.')