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

Unified Diff: tools/perf/profile_creators/history_profile_extender_unittest.py

Issue 914253005: Telemetry: Create new profile creator large_profile_creator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from sullivan. Created 5 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: tools/perf/profile_creators/history_profile_extender_unittest.py
diff --git a/tools/perf/profile_creators/history_profile_extender_unittest.py b/tools/perf/profile_creators/history_profile_extender_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..4f9cc867d15c1edf9348ae914778d10439e9d9c0
--- /dev/null
+++ b/tools/perf/profile_creators/history_profile_extender_unittest.py
@@ -0,0 +1,44 @@
+# Copyright 2015 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 shutil
+import tempfile
+import unittest
+
+from profile_creators.history_profile_extender import HistoryProfileExtender
+from telemetry import decorators
+from telemetry.core import util
+from telemetry.unittest_util import options_for_unittests
+
+util.AddDirToPythonPath(util.GetTelemetryDir(), 'third_party', 'mock')
+import mock
+
+
+# Testing private method.
+# pylint: disable=protected-access
+class HistoryProfileExtenderTest(unittest.TestCase):
+ # The profile extender does not work on Android or ChromeOS.
+ @decorators.Disabled('android', 'chromeos')
+ def testFullFunctionality(self):
+ extender = HistoryProfileExtender()
+
+ # Stop the extender at the earliest possible opportunity.
+ extender.ShouldExitAfterBatchNavigation = mock.MagicMock(return_value=True)
+ # Normally, the number of tabs depends on the number of cores. Use a
+ # static, small number to increase the speed of the test.
+ extender._NUM_TABS = 3
+
+ options = options_for_unittests.GetCopy()
+ options.output_profile_path = tempfile.mkdtemp()
+
+ try:
+ extender.Run(options)
+ self.assertEquals(extender.profile_path, options.output_profile_path)
+ self.assertTrue(os.path.exists(extender.profile_path))
+ history_db_path = os.path.join(extender.profile_path, "Default",
+ "History")
+ stat_info = os.stat(history_db_path)
+ self.assertGreater(stat_info.st_size, 1000)
+ finally:
+ shutil.rmtree(options.output_profile_path)
« no previous file with comments | « tools/perf/profile_creators/history_profile_extender.py ('k') | tools/perf/profile_creators/large_profile_creator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698