[Android WebViewShell] Add inclusion test for webview exposed stable interfaces.
[chromium-blink-merge.git] / tools / perf / profile_creators / history_profile_extender_unittest.py
blob6cd671199534d93f0a5418b11a161e70b1145fed
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.core import util
11 from telemetry import decorators
12 from telemetry.testing import options_for_unittests
14 util.AddDirToPythonPath(util.GetTelemetryDir(), 'third_party', 'mock')
15 import mock # pylint: disable=import-error
18 # Testing private method.
19 # pylint: disable=protected-access
20 class HistoryProfileExtenderTest(unittest.TestCase):
21 # The profile extender does not work on Android or ChromeOS.
22 @decorators.Disabled('android', 'chromeos')
23 def testFullFunctionality(self):
24 options = options_for_unittests.GetCopy()
25 options.output_profile_path = tempfile.mkdtemp()
26 extender = HistoryProfileExtender(options)
28 # Stop the extender at the earliest possible opportunity.
29 extender.ShouldExitAfterBatchNavigation = mock.MagicMock(return_value=True)
30 # Normally, the number of tabs depends on the number of cores. Use a
31 # static, small number to increase the speed of the test.
32 extender._NUM_TABS = 3
34 try:
35 extender.Run()
36 self.assertEquals(extender.profile_path, options.output_profile_path)
37 self.assertTrue(os.path.exists(extender.profile_path))
38 history_db_path = os.path.join(extender.profile_path, "Default",
39 "History")
40 stat_info = os.stat(history_db_path)
41 self.assertGreater(stat_info.st_size, 1000)
42 finally:
43 shutil.rmtree(options.output_profile_path)