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 <XCTest/XCTest.h> | 6 #import <XCTest/XCTest.h> |
7 | 7 |
8 #include "components/strings/grit/components_strings.h" | 8 #include "components/strings/grit/components_strings.h" |
9 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 9 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
10 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 10 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
11 #import "ios/chrome/browser/ui/ntp/new_tab_page_controller.h" | 11 #import "ios/chrome/browser/ui/ntp/new_tab_page_controller.h" |
12 #include "ios/chrome/browser/ui/ui_util.h" | 12 #include "ios/chrome/browser/ui/ui_util.h" |
13 #include "ios/chrome/grit/ios_strings.h" | 13 #include "ios/chrome/grit/ios_strings.h" |
14 #import "ios/chrome/test/app/chrome_test_util.h" | 14 #import "ios/chrome/test/app/chrome_test_util.h" |
15 #import "ios/chrome/test/app/tab_test_util.h" | 15 #import "ios/chrome/test/app/tab_test_util.h" |
16 #import "ios/chrome/test/earl_grey/accessibility_util.h" | 16 #import "ios/chrome/test/earl_grey/accessibility_util.h" |
17 #import "ios/chrome/test/earl_grey/chrome_matchers.h" | 17 #import "ios/chrome/test/earl_grey/chrome_matchers.h" |
18 #import "ios/chrome/test/earl_grey/chrome_test_case.h" | 18 #import "ios/chrome/test/earl_grey/chrome_test_case.h" |
19 #import "ios/testing/earl_grey/disabled_test_macros.h" | 19 #import "ios/testing/earl_grey/disabled_test_macros.h" |
20 #import "ios/testing/wait_util.h" | 20 #import "ios/testing/wait_util.h" |
21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
22 | 22 |
| 23 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 24 #error "This file requires ARC support." |
| 25 #endif |
| 26 |
23 @implementation NewTabPageController (ExposedForTesting) | 27 @implementation NewTabPageController (ExposedForTesting) |
24 - (GoogleLandingController*)googleLandingController { | 28 - (GoogleLandingController*)googleLandingController { |
25 return googleLandingController_; | 29 return googleLandingController_; |
26 } | 30 } |
27 @end | 31 @end |
28 | 32 |
29 @interface GoogleLandingController (ExposedForTesting) | 33 @interface GoogleLandingController (ExposedForTesting) |
30 - (BOOL)scrolledToTop; | 34 - (BOOL)scrolledToTop; |
31 - (BOOL)animateHeader; | 35 - (BOOL)animateHeader; |
32 @end | 36 @end |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 if (IsIPadIdiom()) { | 70 if (IsIPadIdiom()) { |
67 [ntp_controller selectPanel:panel_type]; | 71 [ntp_controller selectPanel:panel_type]; |
68 } else { | 72 } else { |
69 NSUInteger tag = 0; | 73 NSUInteger tag = 0; |
70 if (panel_type == NewTabPage::PanelIdentifier::kBookmarksPanel) { | 74 if (panel_type == NewTabPage::PanelIdentifier::kBookmarksPanel) { |
71 tag = IDC_SHOW_BOOKMARK_MANAGER; | 75 tag = IDC_SHOW_BOOKMARK_MANAGER; |
72 } else if (panel_type == NewTabPage::PanelIdentifier::kOpenTabsPanel) { | 76 } else if (panel_type == NewTabPage::PanelIdentifier::kOpenTabsPanel) { |
73 tag = IDC_SHOW_OTHER_DEVICES; | 77 tag = IDC_SHOW_OTHER_DEVICES; |
74 } | 78 } |
75 if (tag) { | 79 if (tag) { |
76 base::scoped_nsobject<GenericChromeCommand> command( | 80 GenericChromeCommand* command = |
77 [[GenericChromeCommand alloc] initWithTag:tag]); | 81 [[GenericChromeCommand alloc] initWithTag:tag]; |
78 chrome_test_util::RunCommandWithActiveViewController(command); | 82 chrome_test_util::RunCommandWithActiveViewController(command); |
79 } | 83 } |
80 } | 84 } |
81 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; | 85 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; |
82 } | 86 } |
83 | 87 |
84 void AssertNTPScrolledToTop(bool scrolledToTop) { | 88 void AssertNTPScrolledToTop(bool scrolledToTop) { |
85 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; | 89 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; |
86 NewTabPageController* ntp_controller = | 90 NewTabPageController* ntp_controller = |
87 chrome_test_util::GetCurrentNewTabPageController(); | 91 chrome_test_util::GetCurrentNewTabPageController(); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 AssertNTPScrolledToTop(YES); | 310 AssertNTPScrolledToTop(YES); |
307 | 311 |
308 // Check that tab switcher and tools menu buttons are not on screen. | 312 // Check that tab switcher and tools menu buttons are not on screen. |
309 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(tabSwitcherLabel)] | 313 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(tabSwitcherLabel)] |
310 assertWithMatcher:grey_notVisible()]; | 314 assertWithMatcher:grey_notVisible()]; |
311 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(toolsMenuLabel)] | 315 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(toolsMenuLabel)] |
312 assertWithMatcher:grey_notVisible()]; | 316 assertWithMatcher:grey_notVisible()]; |
313 } | 317 } |
314 | 318 |
315 @end | 319 @end |
OLD | NEW |