| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_AUTOMATED_UI_TESTS_AUTOMATED_UI_TEST_BASE_H_ | 5 #ifndef CHROME_TEST_AUTOMATED_UI_TESTS_AUTOMATED_UI_TEST_BASE_H_ |
| 6 #define CHROME_TEST_AUTOMATED_UI_TESTS_AUTOMATED_UI_TEST_BASE_H_ | 6 #define CHROME_TEST_AUTOMATED_UI_TESTS_AUTOMATED_UI_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include "chrome/test/ui/ui_test.h" | 8 #include "chrome/test/ui/ui_test.h" |
| 9 | 9 |
| 10 class AutomatedUITestBase : public UITest { | 10 class AutomatedUITestBase : public UITest { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // Opens a new tab in the active window using an accelerator. | 55 // Opens a new tab in the active window using an accelerator. |
| 56 // Returns true if a new tab is successfully opened. | 56 // Returns true if a new tab is successfully opened. |
| 57 bool NewTab(); | 57 bool NewTab(); |
| 58 | 58 |
| 59 // Opens a new browser window by calling automation()->OpenNewBrowserWindow. | 59 // Opens a new browser window by calling automation()->OpenNewBrowserWindow. |
| 60 // Then activates the tab opened in the new window. | 60 // Then activates the tab opened in the new window. |
| 61 // Returns true if window is successfully created. | 61 // Returns true if window is successfully created. |
| 62 // If optional parameter previous_browser is passed in, it is set to be the | 62 // If optional parameter previous_browser is passed in, it is set to be the |
| 63 // previous browser window when new window is successfully created, and the | 63 // previous browser window when new window is successfully created, and the |
| 64 // caller owns previous_browser. | 64 // caller owns previous_browser. |
| 65 bool OpenAndActivateNewBrowserWindow(BrowserProxy** previous_browser); | 65 bool OpenAndActivateNewBrowserWindow( |
| 66 scoped_refptr<BrowserProxy>* previous_browser); |
| 66 | 67 |
| 67 // Reload the active tab. | 68 // Reload the active tab. |
| 68 // Returns true if successful, false otherwise. | 69 // Returns true if successful, false otherwise. |
| 69 bool ReloadPage(); | 70 bool ReloadPage(); |
| 70 | 71 |
| 71 // Restores a previously closed tab. | 72 // Restores a previously closed tab. |
| 72 // Returns true if the tab is successfully restored. | 73 // Returns true if the tab is successfully restored. |
| 73 bool RestoreTab(); | 74 bool RestoreTab(); |
| 74 | 75 |
| 75 // Runs the specified browser command in the current active browser. | 76 // Runs the specified browser command in the current active browser. |
| 76 // See browser_commands.cc for the list of commands. | 77 // See browser_commands.cc for the list of commands. |
| 77 // Returns true if the call is successfully dispatched. | 78 // Returns true if the call is successfully dispatched. |
| 78 // Possible failures include the active window is not a browser window or | 79 // Possible failures include the active window is not a browser window or |
| 79 // the message to apply the accelerator fails. | 80 // the message to apply the accelerator fails. |
| 80 bool RunCommandAsync(int browser_command); | 81 bool RunCommandAsync(int browser_command); |
| 81 | 82 |
| 82 // Runs the specified browser command in the current active browser, wait | 83 // Runs the specified browser command in the current active browser, wait |
| 83 // and return until the command has finished executing. | 84 // and return until the command has finished executing. |
| 84 // See browser_commands.cc for the list of commands. | 85 // See browser_commands.cc for the list of commands. |
| 85 // Returns true if the call is successfully dispatched and executed. | 86 // Returns true if the call is successfully dispatched and executed. |
| 86 // Possible failures include the active window is not a browser window, or | 87 // Possible failures include the active window is not a browser window, or |
| 87 // the message to apply the accelerator fails, or the command execution | 88 // the message to apply the accelerator fails, or the command execution |
| 88 // fails. | 89 // fails. |
| 89 bool RunCommand(int browser_command); | 90 bool RunCommand(int browser_command); |
| 90 | 91 |
| 91 void set_active_browser(BrowserProxy* browser) { | 92 void set_active_browser(BrowserProxy* browser) { |
| 92 active_browser_.reset(browser); | 93 active_browser_ = browser; |
| 93 } | 94 } |
| 94 BrowserProxy* active_browser() const { return active_browser_.get(); } | 95 BrowserProxy* active_browser() const { return active_browser_.get(); } |
| 95 | 96 |
| 96 // Get the selected tab within the current active browser window, then | 97 // Get the selected tab within the current active browser window, then |
| 97 // create a corresponding TabProxy and transfer the ownership to caller. | 98 // create a corresponding TabProxy and transfer the ownership to caller. |
| 98 // If success return the pointer to the newly created TabProxy and the | 99 // If success return the pointer to the newly created TabProxy and the |
| 99 // caller owns the TabProxy. Return NULL otherwise. | 100 // caller owns the TabProxy. Return NULL otherwise. |
| 100 TabProxy* GetActiveTab(); | 101 scoped_refptr<TabProxy> GetActiveTab(); |
| 101 private: | 102 private: |
| 102 scoped_ptr<BrowserProxy> active_browser_; | 103 scoped_refptr<BrowserProxy> active_browser_; |
| 103 | 104 |
| 104 DISALLOW_COPY_AND_ASSIGN(AutomatedUITestBase); | 105 DISALLOW_COPY_AND_ASSIGN(AutomatedUITestBase); |
| 105 }; | 106 }; |
| 106 | 107 |
| 107 #endif // CHROME_TEST_AUTOMATED_UI_TESTS_AUTOMATED_UI_TEST_BASE_H_ | 108 #endif // CHROME_TEST_AUTOMATED_UI_TESTS_AUTOMATED_UI_TEST_BASE_H_ |
| OLD | NEW |