| 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 codecs | 6 import codecs |
| 7 import os | 7 import os |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 import pyauto_functional | 10 import pyauto_functional |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 chrome://history, chrome://downloads, pyAuto Data directory | 80 chrome://history, chrome://downloads, pyAuto Data directory |
| 81 """ | 81 """ |
| 82 zip_file = 'a_zip_file.zip' | 82 zip_file = 'a_zip_file.zip' |
| 83 self.NavigateToURL(self.GetFileURLForPath(self.DataDir())) | 83 self.NavigateToURL(self.GetFileURLForPath(self.DataDir())) |
| 84 # search in Data directory | 84 # search in Data directory |
| 85 self.assertEqual(1, | 85 self.assertEqual(1, |
| 86 self.FindInPage('downloads', tab_index=0)['match_count']) | 86 self.FindInPage('downloads', tab_index=0)['match_count']) |
| 87 # search in History page | 87 # search in History page |
| 88 self.AppendTab(pyauto.GURL('chrome://history')) | 88 self.AppendTab(pyauto.GURL('chrome://history')) |
| 89 # the contents in the history page load asynchronously after tab loads | 89 # the contents in the history page load asynchronously after tab loads |
| 90 search_query = os.path.join('chrome', 'test', 'data') |
| 90 self.WaitUntil( | 91 self.WaitUntil( |
| 91 lambda: self.FindInPage('data', tab_index=1)['match_count'], | 92 lambda: self.FindInPage(search_query, tab_index=1)['match_count'], |
| 92 expect_retval=1) | 93 expect_retval=1) |
| 93 self.assertEqual(1, self.FindInPage('data', tab_index=1)['match_count']) | 94 self.assertEqual( |
| 95 1, self.FindInPage(search_query, tab_index=1)['match_count']) |
| 94 # search in Downloads page | 96 # search in Downloads page |
| 95 test_utils.DownloadFileFromDownloadsDataDir(self, zip_file) | 97 test_utils.DownloadFileFromDownloadsDataDir(self, zip_file) |
| 96 self.AppendTab(pyauto.GURL('chrome://downloads')) | 98 self.AppendTab(pyauto.GURL('chrome://downloads')) |
| 97 # the contents in the downloads page load asynchronously after tab loads | 99 # the contents in the downloads page load asynchronously after tab loads |
| 98 self.WaitUntil( | 100 self.WaitUntil( |
| 99 lambda: self.FindInPage(zip_file, tab_index=2)['match_count'], | 101 lambda: self.FindInPage(zip_file, tab_index=2)['match_count'], |
| 100 expect_retval=2) | 102 expect_retval=2) |
| 101 self.assertEqual(2, | 103 self.assertEqual(2, |
| 102 self.FindInPage(zip_file, tab_index=2)['match_count']) | 104 self.FindInPage(zip_file, tab_index=2)['match_count']) |
| 103 test_utils.RemoveDownloadedTestFile(self, zip_file) | 105 test_utils.RemoveDownloadedTestFile(self, zip_file) |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 return | 241 return |
| 240 url = self.GetFileURLForPath(os.path.join( | 242 url = self.GetFileURLForPath(os.path.join( |
| 241 self.DataDir(), 'pdf_browsertest.pdf')) | 243 self.DataDir(), 'pdf_browsertest.pdf')) |
| 242 self.NavigateToURL(url) | 244 self.NavigateToURL(url) |
| 243 search_count = self.FindInPage('venenatis')['match_count'] | 245 search_count = self.FindInPage('venenatis')['match_count'] |
| 244 self.assertEqual(4, search_count, 'Failed to find in the pdf file') | 246 self.assertEqual(4, search_count, 'Failed to find in the pdf file') |
| 245 | 247 |
| 246 | 248 |
| 247 if __name__ == '__main__': | 249 if __name__ == '__main__': |
| 248 pyauto_functional.Main() | 250 pyauto_functional.Main() |
| OLD | NEW |