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

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

Issue 939143004: Telemetry: Fix several small problems in the profile creator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit test. 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
« no previous file with comments | « tools/perf/profile_creators/fast_navigation_profile_extender.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/profile_creators/fast_navigation_profile_extender_unittest.py
diff --git a/tools/perf/profile_creators/fast_navigation_profile_extender_unittest.py b/tools/perf/profile_creators/fast_navigation_profile_extender_unittest.py
index 2a2af9d779e7da4ecb73a5eb94af6e605c8a402c..05cf334e546fa728003c8b4e1e35e16868469481 100644
--- a/tools/perf/profile_creators/fast_navigation_profile_extender_unittest.py
+++ b/tools/perf/profile_creators/fast_navigation_profile_extender_unittest.py
@@ -15,11 +15,22 @@ class FakeTab(object):
pass
+class FakeTabList(object):
+ def __init__(self):
+ self._tabs = []
+
+ def New(self):
+ tab = FakeTab()
+ self._tabs.append(tab)
+ return tab
+
+ def __len__(self):
+ return len(self._tabs)
+
+
class FakeBrowser(object):
- def __init__(self, tab_count):
- self.tabs = []
- for _ in range(tab_count):
- self.tabs.append(FakeTab())
+ def __init__(self):
+ self.tabs = FakeTabList()
# Testing private method.
@@ -40,7 +51,7 @@ class FastNavigationProfileExtenderTest(unittest.TestCase):
extender.ShouldExitAfterBatchNavigation = mock.MagicMock(return_value=True)
extender._WaitForQueuedTabsToLoad = mock.MagicMock()
- extender._browser = FakeBrowser(extender._NUM_TABS)
+ extender._browser = FakeBrowser()
extender._BatchNavigateTabs = mock.MagicMock()
# Set up a callback to record the tabs and urls in each navigation.
@@ -67,7 +78,7 @@ class FastNavigationProfileExtenderTest(unittest.TestCase):
# The first couple of tabs should have been navigated once. The remaining
# tabs should not have been navigated.
for i in range(len(extender._browser.tabs)):
- tab = extender._browser.tabs[i]
+ tab = extender._browser.tabs._tabs[i]
if i < batch_size:
expected_tab_navigation_count = 1
« no previous file with comments | « tools/perf/profile_creators/fast_navigation_profile_extender.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698