OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_TEST_APP_CHROME_TEST_UTIL_H_ |
| 6 #define IOS_CHROME_TEST_APP_CHROME_TEST_UTIL_H_ |
| 7 |
| 8 #include "base/ios/block_types.h" |
| 9 #import "ios/web/public/web_state/web_state.h" |
| 10 |
| 11 namespace ios { |
| 12 class ChromeBrowserState; |
| 13 } |
| 14 |
| 15 @class DeviceSharingManager; |
| 16 @class GenericChromeCommand; |
| 17 @class MainController; |
| 18 @class NewTabPageController; |
| 19 |
| 20 namespace chrome_test_util { |
| 21 |
| 22 // Returns the main controller. |
| 23 MainController* GetMainController(); |
| 24 |
| 25 // Returns the DeviceSharingManager object. |
| 26 DeviceSharingManager* GetDeviceSharingManager(); |
| 27 |
| 28 // Returns the |NewTabPageController| of the current tab if the current tab is |
| 29 // a new tab and nil otherwise. |
| 30 NewTabPageController* GetCurrentNewTabPageController(); |
| 31 |
| 32 // Returns the current WebState. |
| 33 web::WebState* GetCurrentWebState(); |
| 34 |
| 35 // Returns the current, non-incognito ChromeBrowserState. |
| 36 ios::ChromeBrowserState* GetOriginalBrowserState(); |
| 37 |
| 38 // Returns the current incognito ChromeBrowserState |
| 39 ios::ChromeBrowserState* GetCurrentIncognitoBrowserState(); |
| 40 |
| 41 // Returns the number of key commands currently registered with the main BVC. |
| 42 NSUInteger GetRegisteredKeyCommandsCount(); |
| 43 |
| 44 // Runs |command| using the active view controller. |
| 45 void RunCommandWithActiveViewController(GenericChromeCommand* command); |
| 46 |
| 47 // Removes all presented infobars. |
| 48 void RemoveAllInfoBars(); |
| 49 |
| 50 // Dismisses all presented views and modal dialogs. |
| 51 void ClearPresentedState(); |
| 52 |
| 53 // Purges and recreates all web views. |
| 54 void ResetAllWebViews(); |
| 55 |
| 56 // Sets the value of a boolean local state pref. |
| 57 // TODO(crbug.com/647022): Clean up other tests that use this helper function. |
| 58 void SetBooleanLocalStatePref(const char* pref_name, bool value); |
| 59 |
| 60 // Sets the value of a boolean user pref in the given browser state. |
| 61 void SetBooleanUserPref(ios::ChromeBrowserState* browser_state, |
| 62 const char* pref_name, |
| 63 bool value); |
| 64 |
| 65 // Sets the state of using cellular network. |
| 66 void SetWWANStateTo(bool value); |
| 67 |
| 68 // Sets the state of first launch. |
| 69 void SetFirstLaunchStateTo(bool value); |
| 70 |
| 71 // Check whether metrics recording is enabled or not. |
| 72 bool IsMetricsRecordingEnabled(); |
| 73 |
| 74 // Check whether metrics reporting is enabled or not. |
| 75 bool IsMetricsReportingEnabled(); |
| 76 |
| 77 // Check whether breakpad recording is enabled or not. |
| 78 bool IsBreakpadEnabled(); |
| 79 |
| 80 // Check whether breakpad reporting is enabled or not. |
| 81 bool IsBreakpadReportingEnabled(); |
| 82 |
| 83 // Check whether this is the first launch after upgrade or not. |
| 84 bool IsFirstLaunchAfterUpgrade(); |
| 85 |
| 86 // Simulate launching Chrome from another application. |
| 87 void OpenChromeFromExternalApp(const GURL& url); |
| 88 |
| 89 } // namespace chrome_test_util |
| 90 |
| 91 #endif // IOS_CHROME_TEST_APP_CHROME_TEST_UTIL_H_ |
OLD | NEW |