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

Side by Side Diff: chrome/test/functional/tracing/tab_tracker.py

Issue 10736055: Smoke test for tracing infrastructure in PyAuto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up js TimelineModel when the python TimelineModelProxy is deleted. Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2011 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
5 import uuid
6
7 # The TabTracker class allows the creation of tabs whose indices can be
Nirnimesh 2012/07/30 18:57:19 This sounds like a docstring. Move inside the clas
8 # determined even after lower indexed tabs have been closed, therefore changing
9 # that tab's index.
10 class TabTracker:
11 def __init__(self, browser, visible = False):
Nirnimesh 2012/07/30 18:57:19 remove parents around =
Nirnimesh 2012/07/30 18:58:03 err.. parents -> space
12 # A binary search tree would be faster, but this is easier to write.
13 # If this needs to become faster, understand that the important operations
14 # here are append, arbitrary deletion and searching.
15 self._uuids = [None]
16 self._window_idx = browser.GetBrowserWindowCount()
17 self._browser = browser
18 browser.OpenNewBrowserWindow(visible)
19 # We leave the 0'th tab empty to have something to close on __del__
20
21 def __del__(self):
22 self._browser.CloseBrowserWindow(self._window_idx)
23
24 def createTab(self, url="about:blank"):
Nirnimesh 2012/07/30 18:57:19 createTab -> CreateTab Please repeat for all meth
Nirnimesh 2012/07/30 18:57:19 use single quote char ' instead of " for consisten
Nirnimesh 2012/07/30 18:57:19 Add docstring, with an Args: section.
25 self._browser.AppendTab(url, self._window_idx)
26 # We use uuids here rather than a monotonic integer to prevent confusion
27 # with the tab index.
28 tab_uuid = uuid.uuid4()
29 self._uuids.append(tab_uuid)
30 return tab_uuid
31
32 def releaseTab(self, tab_uuid):
33 idx = self.getTabIndex(tab_uuid)
34 self._browser.GetBrowserWindow(self._window_idx).GetTab(idx).Close()
35 del self._uuids[idx]
36
37 def getTabIndex(self, tab_uuid):
38 return self._uuids.index(tab_uuid)
39
40 def getWindowIndex(self):
41 return self._window_idx
OLDNEW
« no previous file with comments | « chrome/test/functional/tracing/pyauto_tracing.py ('k') | chrome/test/functional/tracing/timeline_model.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698