OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 os | 6 import os |
7 import re | 7 import re |
8 import shutil | 8 import shutil |
9 import tempfile | 9 import tempfile |
10 | 10 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 def testInlinAutoComplete(self): | 113 def testInlinAutoComplete(self): |
114 """Verify inline autocomplete for a pre-visited url.""" | 114 """Verify inline autocomplete for a pre-visited url.""" |
115 self.NavigateToURL('http://www.google.com') | 115 self.NavigateToURL('http://www.google.com') |
116 matches = self._GetOmniboxMatchesFor('goog') | 116 matches = self._GetOmniboxMatchesFor('goog') |
117 self.assertTrue(matches) | 117 self.assertTrue(matches) |
118 # Omnibox should suggest auto completed url as the first item | 118 # Omnibox should suggest auto completed url as the first item |
119 matches_description = matches[0] | 119 matches_description = matches[0] |
120 self.assertTrue('www.google.com' in matches_description['contents']) | 120 self.assertTrue('www.google.com' in matches_description['contents']) |
121 self.assertEqual('history-url', matches_description['type']) | 121 self.assertEqual('history-url', matches_description['type']) |
122 # The url should be inline-autocompleted in the omnibox | 122 # The url should be inline-autocompleted in the omnibox |
123 self.assertEqual('google.com/', self.GetOmniboxInfo().Text()) | 123 self.assertTrue('google.com' in self.GetOmniboxInfo().Text()) |
124 | 124 |
125 def testCrazyFilenames(self): | 125 def testCrazyFilenames(self): |
126 """Test omnibox query with filenames containing special chars. | 126 """Test omnibox query with filenames containing special chars. |
127 | 127 |
128 The files are created on the fly and cleaned after use. | 128 The files are created on the fly and cleaned after use. |
129 """ | 129 """ |
130 filename = os.path.join(self.DataDir(), 'downloads', 'crazy_filenames.txt') | 130 filename = os.path.join(self.DataDir(), 'downloads', 'crazy_filenames.txt') |
131 zip_names = self.EvalDataFrom(filename) | 131 zip_names = self.EvalDataFrom(filename) |
132 # We got .zip filenames. Change them to .html | 132 # We got .zip filenames. Change them to .html |
133 crazy_filenames = [x.replace('.zip', '.html') for x in zip_names] | 133 crazy_filenames = [x.replace('.zip', '.html') for x in zip_names] |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 self.assertFalse(self.GetPrefsInfo().Prefs(pyauto.kSearchSuggestEnabled)) | 207 self.assertFalse(self.GetPrefsInfo().Prefs(pyauto.kSearchSuggestEnabled)) |
208 matches = self._GetOmniboxMatchesFor('apple') | 208 matches = self._GetOmniboxMatchesFor('apple') |
209 self.assertTrue(matches) | 209 self.assertTrue(matches) |
210 # Verify there are no suggest results | 210 # Verify there are no suggest results |
211 self.assertFalse([x for x in matches if x['type'] == 'search-suggest']) | 211 self.assertFalse([x for x in matches if x['type'] == 'search-suggest']) |
212 | 212 |
213 | 213 |
214 if __name__ == '__main__': | 214 if __name__ == '__main__': |
215 pyauto_functional.Main() | 215 pyauto_functional.Main() |
216 | 216 |
OLD | NEW |