| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #import <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
| 6 #import <UIKit/UIKit.h> | 6 #import <UIKit/UIKit.h> |
| 7 #import <XCTest/XCTest.h> | 7 #import <XCTest/XCTest.h> |
| 8 | 8 |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #include "base/test/scoped_command_line.h" | |
| 11 #import "ios/chrome/app/main_controller_private.h" | 10 #import "ios/chrome/app/main_controller_private.h" |
| 12 #include "ios/chrome/browser/chrome_switches.h" | 11 #include "ios/chrome/browser/chrome_switches.h" |
| 13 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 12 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
| 14 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 13 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 15 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h" | 14 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h" |
| 16 #import "ios/chrome/browser/ui/ui_util.h" | 15 #import "ios/chrome/browser/ui/ui_util.h" |
| 17 #include "ios/chrome/grit/ios_strings.h" | 16 #include "ios/chrome/grit/ios_strings.h" |
| 18 #import "ios/chrome/test/app/chrome_test_util.h" | 17 #import "ios/chrome/test/app/chrome_test_util.h" |
| 19 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" | 18 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" |
| 20 #import "ios/chrome/test/earl_grey/chrome_matchers.h" | 19 #import "ios/chrome/test/earl_grey/chrome_matchers.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 base::scoped_nsobject<GenericChromeCommand> command( | 75 base::scoped_nsobject<GenericChromeCommand> command( |
| 77 [[GenericChromeCommand alloc] initWithTag:IDC_TOGGLE_TAB_SWITCHER]); | 76 [[GenericChromeCommand alloc] initWithTag:IDC_TOGGLE_TAB_SWITCHER]); |
| 78 chrome_test_util::RunCommandWithActiveViewController(command); | 77 chrome_test_util::RunCommandWithActiveViewController(command); |
| 79 } | 78 } |
| 80 | 79 |
| 81 } // namespace | 80 } // namespace |
| 82 | 81 |
| 83 @interface TabSwitcherControllerTestCase : ChromeTestCase | 82 @interface TabSwitcherControllerTestCase : ChromeTestCase |
| 84 @end | 83 @end |
| 85 | 84 |
| 86 @implementation TabSwitcherControllerTestCase { | 85 @implementation TabSwitcherControllerTestCase |
| 87 std::unique_ptr<base::test::ScopedCommandLine> scoped_command_line_; | |
| 88 } | |
| 89 | |
| 90 - (void)setUp { | |
| 91 [super setUp]; | |
| 92 scoped_command_line_.reset(new base::test::ScopedCommandLine()); | |
| 93 scoped_command_line_->GetProcessCommandLine()->AppendSwitch( | |
| 94 switches::kEnableTabSwitcher); | |
| 95 } | |
| 96 | 86 |
| 97 // Checks that the tab switcher is not presented. | 87 // Checks that the tab switcher is not presented. |
| 98 - (void)assertTabSwitcherIsInactive { | 88 - (void)assertTabSwitcherIsInactive { |
| 99 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; | 89 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; |
| 100 MainController* main_controller = chrome_test_util::GetMainController(); | 90 MainController* main_controller = chrome_test_util::GetMainController(); |
| 101 GREYAssertTrue(![main_controller isTabSwitcherActive], | 91 GREYAssertTrue(![main_controller isTabSwitcherActive], |
| 102 @"Tab Switcher should be inactive"); | 92 @"Tab Switcher should be inactive"); |
| 103 } | 93 } |
| 104 | 94 |
| 105 // Checks that the tab switcher is active. | 95 // Checks that the tab switcher is active. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 202 |
| 213 // Press the :: icon to exit the tab switcher. | 203 // Press the :: icon to exit the tab switcher. |
| 214 [[EarlGrey selectElementWithMatcher:TabSwitcherCloseButton()] | 204 [[EarlGrey selectElementWithMatcher:TabSwitcherCloseButton()] |
| 215 performAction:grey_tap()]; | 205 performAction:grey_tap()]; |
| 216 | 206 |
| 217 // Verify that we've left the tab switcher. | 207 // Verify that we've left the tab switcher. |
| 218 [self assertTabSwitcherIsInactive]; | 208 [self assertTabSwitcherIsInactive]; |
| 219 } | 209 } |
| 220 | 210 |
| 221 @end | 211 @end |
| OLD | NEW |