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

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

Issue 10855161: Improve pyautolib errors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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
« no previous file with comments | « no previous file | chrome/test/functional/webrtc_brutality_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import uuid 5 import uuid
6 6
7 7
8 class TabTracker(object): 8 class TabTracker(object):
9 """Uniquely track tabs within a window. 9 """Uniquely track tabs within a window.
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 self._uuids.append(tab_uuid) 53 self._uuids.append(tab_uuid)
54 return tab_uuid 54 return tab_uuid
55 55
56 def ReleaseTab(self, tab_uuid): 56 def ReleaseTab(self, tab_uuid):
57 """Release and close a tab tracked by this TabTracker. 57 """Release and close a tab tracked by this TabTracker.
58 58
59 Args: 59 Args:
60 tab_uuid: the uuid of the tab to close 60 tab_uuid: the uuid of the tab to close
61 """ 61 """
62 idx = self.GetTabIndex(tab_uuid) 62 idx = self.GetTabIndex(tab_uuid)
63 self._browser.GetBrowserWindow(self._window_idx).GetTab(idx).Close() 63 self._browser.CloseTab(tab_index=idx, windex=self._window_idx)
64 del self._uuids[idx] 64 del self._uuids[idx]
65 65
66 def GetTabIndex(self, tab_uuid): 66 def GetTabIndex(self, tab_uuid):
67 """Get the index of a tracked tab within this TabTracker's window. 67 """Get the index of a tracked tab within this TabTracker's window.
68 68
69 Args: 69 Args:
70 tab_uuid: the uuid of the tab to close 70 tab_uuid: the uuid of the tab to close
71 71
72 Returns: 72 Returns:
73 the index of the tab within this TabTracker's window 73 the index of the tab within this TabTracker's window
74 """ 74 """
75 return self._uuids.index(tab_uuid) 75 return self._uuids.index(tab_uuid)
76 76
77 def GetWindowIndex(self): 77 def GetWindowIndex(self):
78 """Get the index of this TabTracker's window. 78 """Get the index of this TabTracker's window.
79 79
80 Returns: 80 Returns:
81 the index of this TabTracker's window 81 the index of this TabTracker's window
82 """ 82 """
83 return self._window_idx 83 return self._window_idx
OLDNEW
« no previous file with comments | « no previous file | chrome/test/functional/webrtc_brutality_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698