Remove linux_chromium_gn_dbg from the chromium CQ.
[chromium-blink-merge.git] / tools / perf / profile_creators / history_profile_extender_unittest.py
blob66de67fcff5611e7db4cde6f94014d6dc99fc19e
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 import os
5 import shutil
6 import tempfile
7 import unittest
9 from profile_creators.history_profile_extender import HistoryProfileExtender
10 from telemetry import decorators
11 from telemetry.testing import options_for_unittests
13 import mock # pylint: disable=import-error
16 # Testing private method.
17 # pylint: disable=protected-access
18 class HistoryProfileExtenderTest(unittest.TestCase):
19 # The profile extender does not work on Android or ChromeOS.
20 @decorators.Disabled('android', 'chromeos')
21 def testFullFunctionality(self):
22 options = options_for_unittests.GetCopy()
23 options.output_profile_path = tempfile.mkdtemp()
24 extender = HistoryProfileExtender(options)
26 # Stop the extender at the earliest possible opportunity.
27 extender.ShouldExitAfterBatchNavigation = mock.MagicMock(return_value=True)
28 # Normally, the number of tabs depends on the number of cores. Use a
29 # static, small number to increase the speed of the test.
30 extender._NUM_TABS = 3
32 try:
33 extender.Run()
34 self.assertEquals(extender.profile_path, options.output_profile_path)
35 self.assertTrue(os.path.exists(extender.profile_path))
36 history_db_path = os.path.join(extender.profile_path, "Default",
37 "History")
38 stat_info = os.stat(history_db_path)
39 self.assertGreater(stat_info.st_size, 1000)
40 finally:
41 shutil.rmtree(options.output_profile_path)