Chromium Code Reviews| 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 { |
| 11 protected: | 11 protected: |
| 12 AutomatedUITestBase(); | 12 AutomatedUITestBase(); |
| 13 virtual ~AutomatedUITestBase(); | 13 virtual ~AutomatedUITestBase(); |
| 14 | 14 |
| 15 virtual void SetUp(); | 15 virtual void SetUp(); |
| 16 | 16 |
| 17 virtual void LogErrorMessage(const std::string &error); | 17 virtual void LogErrorMessage(const std::string &error); |
| 18 virtual void LogWarningMessage(const std::string &warning); | 18 virtual void LogWarningMessage(const std::string &warning); |
| 19 virtual void LogInfoMessage(const std::string &info); | 19 virtual void LogInfoMessage(const std::string &info); |
| 20 | 20 |
| 21 // Actions | 21 // Actions |
| 22 | 22 |
| 23 // NOTE: This list is sorted alphabetically. | 23 // NOTE: This list is sorted alphabetically. |
| 24 // All functions are synchronous unless specified with Async. | |
| 25 | |
| 26 // Close the selected tab in the current browser window. The function will | |
| 27 // not try close the tab if it is the only tab of the last normal window. | |
| 28 // Returns true if the tab is closed, false otherwise. | |
|
Finnur
2009/05/01 04:05:49
Please document why we never close the last tab of
| |
| 29 bool CloseActiveTab(); | |
| 30 | |
| 31 // Close the current browser window if it is not the only window left. | |
| 32 // Returns true if the window is closed, false otherwise. | |
|
Finnur
2009/05/01 04:05:49
Please document why we never close the last window
| |
| 33 bool CloseActiveWindow(); | |
| 24 | 34 |
| 25 // Duplicates the current tab. | 35 // Duplicates the current tab. |
| 26 // Returns true if a duplicated tab is added. | 36 // Returns true if a duplicated tab is added. |
| 27 bool DuplicateTab(); | 37 bool DuplicateTab(); |
| 28 | 38 |
| 29 // Opens a new tab in the active window using an accelerator. | 39 // Opens a new tab in the active window using an accelerator. |
| 30 // Returns true if a new tab is successfully opened. | 40 // Returns true if a new tab is successfully opened. |
| 31 bool NewTab(); | 41 bool NewTab(); |
| 32 | 42 |
| 33 // Opens a new browser window by calling automation()->OpenNewBrowserWindow. | 43 // Opens a new browser window by calling automation()->OpenNewBrowserWindow. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 52 // Possible failures include the active window is not a browser window, or | 62 // Possible failures include the active window is not a browser window, or |
| 53 // the message to apply the accelerator fails, or the command execution | 63 // the message to apply the accelerator fails, or the command execution |
| 54 // fails. | 64 // fails. |
| 55 bool RunCommand(int browser_command); | 65 bool RunCommand(int browser_command); |
| 56 | 66 |
| 57 void set_active_browser(BrowserProxy* browser) { | 67 void set_active_browser(BrowserProxy* browser) { |
| 58 active_browser_.reset(browser); | 68 active_browser_.reset(browser); |
| 59 } | 69 } |
| 60 BrowserProxy* active_browser() const { return active_browser_.get(); } | 70 BrowserProxy* active_browser() const { return active_browser_.get(); } |
| 61 | 71 |
| 72 // Get the selected tab within the current active browser window, then | |
| 73 // create a corresponding TabProxy and transfer the ownership to caller. | |
| 74 // If success return the pointer to the newly created TabProxy and the | |
| 75 // caller owns the TabProxy. Return NULL otherwise. | |
| 76 TabProxy* GetActiveTab(); | |
| 62 private: | 77 private: |
| 63 scoped_ptr<BrowserProxy> active_browser_; | 78 scoped_ptr<BrowserProxy> active_browser_; |
| 64 | 79 |
| 65 DISALLOW_COPY_AND_ASSIGN(AutomatedUITestBase); | 80 DISALLOW_COPY_AND_ASSIGN(AutomatedUITestBase); |
| 66 }; | 81 }; |
| 67 | 82 |
| 68 #endif // CHROME_TEST_AUTOMATED_UI_TESTS_AUTOMATED_UI_TEST_BASE_H_ | 83 #endif // CHROME_TEST_AUTOMATED_UI_TESTS_AUTOMATED_UI_TEST_BASE_H_ |
| OLD | NEW |