OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import logging | 6 import logging |
7 import random | 7 import random |
8 | 8 |
9 import pyauto_functional | 9 import pyauto_functional |
10 from pyauto import PyUITest | 10 from pyauto import PyUITest |
11 from pyauto import GURL | 11 from pyauto import GURL |
12 | 12 |
13 import autotour | 13 import autotour |
Nirnimesh
2012/08/07 00:37:35
This file is obsolete. Please remove it.
craigdh
2012/08/07 21:08:51
Done.
| |
14 | 14 |
15 | 15 |
16 class OmniboxModelTest(autotour.Godel, PyUITest): | 16 class OmniboxModelTest(autotour.Godel, PyUITest): |
17 """Omnibox Model which Opens tabs, navigates to specific URL's and keeps track | 17 """Omnibox Model which Opens tabs, navigates to specific URL's and keeps track |
18 of URL's visited which are then verified agains the Omnibox's info. | 18 of URL's visited which are then verified agains the Omnibox's info. |
19 """ | 19 """ |
20 def __init__(self, methodName='runTest', **kwargs): | 20 def __init__(self, methodName='runTest', **kwargs): |
21 PyUITest.__init__(self, methodName=methodName, **kwargs) | 21 PyUITest.__init__(self, methodName=methodName, **kwargs) |
22 self._tab_count = 1 | 22 self._tab_count = 1 |
23 self._url_map = {} | 23 self._url_map = {} |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 """ | 80 """ |
81 logging.info('#In Open Tab') | 81 logging.info('#In Open Tab') |
82 self._tab_count = self._tab_count + 1 | 82 self._tab_count = self._tab_count + 1 |
83 key = random.choice(self._url_map.keys()) | 83 key = random.choice(self._url_map.keys()) |
84 logging.info('#Navigating to ' + self._url_map[key][0]) | 84 logging.info('#Navigating to ' + self._url_map[key][0]) |
85 self.AppendTab(GURL(self._url_map[key][0])) | 85 self.AppendTab(GURL(self._url_map[key][0])) |
86 self._url_map[key][1] = self._url_map[key][1] + 1 | 86 self._url_map[key][1] = self._url_map[key][1] + 1 |
87 self.VerifyOmniboxInfo() | 87 self.VerifyOmniboxInfo() |
88 | 88 |
89 @autotour.GodelAction(10, CanCloseTab) | 89 @autotour.GodelAction(10, CanCloseTab) |
90 def CloseTab(self): | 90 def CloseFirstTab(self): |
91 """Closes the first tab from the first window""" | 91 """Closes the first tab from the first window""" |
92 self._tab_count = self._tab_count - 1 | 92 self._tab_count = self._tab_count - 1 |
93 self.GetBrowserWindow(0).GetTab(0).Close(True) | 93 self.CloseTab() |
94 | 94 |
95 def VerifyOmniboxInfo(self): | 95 def VerifyOmniboxInfo(self): |
96 for key in self._url_map.keys(): | 96 for key in self._url_map.keys(): |
97 """Verify inline autocomplete for a pre-visited url.""" | 97 """Verify inline autocomplete for a pre-visited url.""" |
98 search_for = key[:3] | 98 search_for = key[:3] |
99 matches = self._GetOmniboxMatchesFor(search_for, windex=0) | 99 matches = self._GetOmniboxMatchesFor(search_for, windex=0) |
100 self.assertTrue(matches) | 100 self.assertTrue(matches) |
101 # Omnibox should suggest auto completed url as the first item | 101 # Omnibox should suggest auto completed url as the first item |
102 matches_description = matches[0] | 102 matches_description = matches[0] |
103 term_to_find = search_for | 103 term_to_find = search_for |
(...skipping 21 matching lines...) Expand all Loading... | |
125 e = autotour.Explorer() | 125 e = autotour.Explorer() |
126 logging.info('#Explorer created') | 126 logging.info('#Explorer created') |
127 e.Add(self) | 127 e.Add(self) |
128 logging.info('#Object added') | 128 logging.info('#Object added') |
129 e.Explore(self.CanNavigate) | 129 e.Explore(self.CanNavigate) |
130 logging.info('#Done') | 130 logging.info('#Done') |
131 | 131 |
132 | 132 |
133 if __name__ == '__main__': | 133 if __name__ == '__main__': |
134 pyauto_functional.Main() | 134 pyauto_functional.Main() |
OLD | NEW |