qutebrowser/tests/unit/browser
Ryan Roden-Corrent 6151b43c47 Fix qute_history benchmark.
This benchmark was running very quickly due to an improper setup.
The current history implementation expects that a newly inserted entry must
be more recent than any existing entries and sorts according to this
assumption.

The benchmark test inserts increasingly older entries, breaking this invariant.
When run in the benchmark, the qute://history/data implementation would
see an entry older than the oldest time in the time window and would
immediately return with a single "next" entry.

This patch inserts data in an order that mantains history's invariant and adds
a sanity-check at the end of the test. It does not check for the exact length
as not all entries will be within the time window. The length will be some
values <= 100000, the check just ensures that there is at least something more
than a "next" entry.

Before:
---------------------------------------------- benchmark: 1 tests ----------------------------------------------
Name (time in us)                  Min      Max    Mean  StdDev  Median     IQR  Outliers(*)  Rounds  Iterations
----------------------------------------------------------------------------------------------------------------
test_qute_history_benchmark     9.3050  21.9250  9.6143  0.2454  9.5880  0.1070      230;360    9930           1
----------------------------------------------------------------------------------------------------------------

After:
-------------------------------------------------- benchmark: 1 tests -------------------------------------------------
Name (time in ms)                    Min       Max      Mean  StdDev    Median     IQR  Outliers(*)  Rounds  Iterations
-----------------------------------------------------------------------------------------------------------------------
test_qute_history_benchmark     220.7040  223.1900  221.7536  1.1070  221.1939  1.8803          1;0       5           1
-----------------------------------------------------------------------------------------------------------------------
2017-04-17 12:15:49 -04:00
..
webengine tests: Adjust percent-encoding tests for Qt 5.9 changes 2017-04-08 19:25:55 +02:00
webkit Add test for QNetworkReply.abort 2017-04-17 16:02:57 +02:00
test_adblock.py Fix adblock UTF-8 test on Windows 2017-03-13 07:01:13 +01:00
test_commands.py tests: Use pytest.fixture instead of yield_fixture 2016-08-22 07:40:24 +02:00
test_pdfjs.py tests: relax pdfjs tests 2016-10-06 16:18:21 +02:00
test_qutescheme.py Fix qute_history benchmark. 2017-04-17 12:15:49 -04:00
test_shared.py QtWebEngine: Implement custom HTTP headers 2016-09-07 18:29:38 +02:00
test_signalfilter.py tests: Use pytest.fixture instead of yield_fixture 2016-08-22 07:40:24 +02:00
test_tab.py Add fullscreen support for QtWebEngine 2017-02-06 16:22:58 +01:00