| OLD | NEW | 
|    1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2006-2008 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 #ifndef CHROME_TEST_UI_UI_TEST_H_ |    5 #ifndef CHROME_TEST_UI_UI_TEST_H_ | 
|    6 #define CHROME_TEST_UI_UI_TEST_H_ |    6 #define CHROME_TEST_UI_UI_TEST_H_ | 
|    7  |    7  | 
|    8 // This file provides a common base for running UI unit tests, which operate |    8 // This file provides a common base for running UI unit tests, which operate | 
|    9 // the entire browser application in a separate process for holistic |    9 // the entire browser application in a separate process for holistic | 
|   10 // functional testing. |   10 // functional testing. | 
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   89   // Tells the browser to navigato to the givne URL in the active tab |   89   // Tells the browser to navigato to the givne URL in the active tab | 
|   90   // of the first app window. |   90   // of the first app window. | 
|   91   // Does not wait for the navigation to complete to return. |   91   // Does not wait for the navigation to complete to return. | 
|   92   void NavigateToURLAsync(const GURL& url); |   92   void NavigateToURLAsync(const GURL& url); | 
|   93  |   93  | 
|   94   // Tells the browser to navigate to the given URL in the active tab |   94   // Tells the browser to navigate to the given URL in the active tab | 
|   95   // of the first app window. |   95   // of the first app window. | 
|   96   // This method doesn't return until the navigation is complete. |   96   // This method doesn't return until the navigation is complete. | 
|   97   void NavigateToURL(const GURL& url); |   97   void NavigateToURL(const GURL& url); | 
|   98  |   98  | 
|   99   // Returns the URL of the currently active tab. If there is no active tab, |   99   // Returns the URL of the currently active tab. Only looks in the first | 
|  100   // or some other error, the returned URL will be empty. |  100   // window, for backward compatibility. If there is no active tab, or some | 
|  101   GURL GetActiveTabURL(); |  101   // other error, the returned URL will be empty. | 
 |  102   GURL GetActiveTabURL() { return GetActiveTabURL(0); } | 
|  102  |  103  | 
|  103   // Returns the title of the currently active tab. |  104   // Like above, but looks at the window at the given index. | 
|  104   std::wstring GetActiveTabTitle(); |  105   GURL GetActiveTabURL(int window_index); | 
|  105  |  106  | 
|  106   // Returns the tabstrip index of the currently active tab, or -1 on error. |  107   // Returns the title of the currently active tab. Only looks in the first | 
|  107   int GetActiveTabIndex(); |  108   // window, for backward compatibility. | 
 |  109   std::wstring GetActiveTabTitle() { return GetActiveTabTitle(0); } | 
 |  110  | 
 |  111   // Like above, but looks at the window at the given index. | 
 |  112   std::wstring GetActiveTabTitle(int window_index); | 
 |  113  | 
 |  114   // Returns the tabstrip index of the currently active tab in the window at | 
 |  115   // the given index, or -1 on error. Only looks in the first window, for | 
 |  116   // backward compatibility. | 
 |  117   int GetActiveTabIndex() { return GetActiveTabIndex(0); } | 
 |  118  | 
 |  119   // Like above, but looks at the window at the given index. | 
 |  120   int GetActiveTabIndex(int window_index); | 
|  108  |  121  | 
|  109   // Returns true when the browser process is running, independent if any |  122   // Returns true when the browser process is running, independent if any | 
|  110   // renderer process exists or not. It will returns false if an user closed the |  123   // renderer process exists or not. It will returns false if an user closed the | 
|  111   // window or if the browser process died by itself. |  124   // window or if the browser process died by itself. | 
|  112   bool IsBrowserRunning(); |  125   bool IsBrowserRunning(); | 
|  113  |  126  | 
|  114   // Returns true when time_out_ms milliseconds have elapsed. |  127   // Returns true when time_out_ms milliseconds have elapsed. | 
|  115   // Returns false if the browser process died while waiting. |  128   // Returns false if the browser process died while waiting. | 
|  116   bool CrashAwareSleep(int time_out_ms); |  129   bool CrashAwareSleep(int time_out_ms); | 
|  117  |  130  | 
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  403     return server_.get(); |  416     return server_.get(); | 
|  404   } |  417   } | 
|  405  |  418  | 
|  406   // Wait a certain amount of time for all the app processes to exit, |  419   // Wait a certain amount of time for all the app processes to exit, | 
|  407   // forcibly killing them if they haven't exited by then. |  420   // forcibly killing them if they haven't exited by then. | 
|  408   // It has the side-effect of killing every browser window opened in your |  421   // It has the side-effect of killing every browser window opened in your | 
|  409   // session, even those unrelated in the test. |  422   // session, even those unrelated in the test. | 
|  410   void CleanupAppProcesses(); |  423   void CleanupAppProcesses(); | 
|  411  |  424  | 
|  412   // Returns the proxy for the currently active tab, or NULL if there is no |  425   // Returns the proxy for the currently active tab, or NULL if there is no | 
|  413   // tab or there was some kind of error. The returned pointer MUST be |  426   // tab or there was some kind of error. Only looks at the first window, for | 
|  414   // deleted by the caller if non-NULL. |  427   // backward compatibility. The returned pointer MUST be deleted by the | 
|  415   TabProxy* GetActiveTab(); |  428   // caller if non-NULL. | 
 |  429   TabProxy* GetActiveTab() { return GetActiveTab(0); } | 
 |  430  | 
 |  431   // Like above, but looks at the window at the given index. | 
 |  432   TabProxy* GetActiveTab(int window_index); | 
|  416  |  433  | 
|  417   // ********* Member variables ********* |  434   // ********* Member variables ********* | 
|  418  |  435  | 
|  419   std::wstring browser_directory_;      // Path to the browser executable, |  436   std::wstring browser_directory_;      // Path to the browser executable, | 
|  420                                         // with no trailing slash |  437                                         // with no trailing slash | 
|  421   std::wstring test_data_directory_;    // Path to the unit test data, |  438   std::wstring test_data_directory_;    // Path to the unit test data, | 
|  422                                         // with no trailing slash |  439                                         // with no trailing slash | 
|  423   CommandLine launch_arguments_;        // Command to launch the browser |  440   CommandLine launch_arguments_;        // Command to launch the browser | 
|  424   size_t expected_errors_;              // The number of errors expected during |  441   size_t expected_errors_;              // The number of errors expected during | 
|  425                                         // the run (generally 0). |  442                                         // the run (generally 0). | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  484 #ifdef UNIT_TEST |  501 #ifdef UNIT_TEST | 
|  485 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr); |  502 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr); | 
|  486  |  503  | 
|  487 template<typename T> |  504 template<typename T> | 
|  488 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) { |  505 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) { | 
|  489   return out << ptr.get(); |  506   return out << ptr.get(); | 
|  490 } |  507 } | 
|  491 #endif  // UNIT_TEST |  508 #endif  // UNIT_TEST | 
|  492  |  509  | 
|  493 #endif  // CHROME_TEST_UI_UI_TEST_H_ |  510 #endif  // CHROME_TEST_UI_UI_TEST_H_ | 
| OLD | NEW |