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 #include "base/mac/bind_objc_block.h" | 5 #include "base/mac/bind_objc_block.h" |
6 #include "base/memory/ptr_util.h" | 6 #include "base/memory/ptr_util.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #import "base/test/ios/wait_util.h" | 10 #import "base/test/ios/wait_util.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "ios/web/public/test/response_providers/delayed_response_provider.h" | 34 #include "ios/web/public/test/response_providers/delayed_response_provider.h" |
35 #include "ios/web/public/test/response_providers/html_response_provider.h" | 35 #include "ios/web/public/test/response_providers/html_response_provider.h" |
36 #include "ui/base/l10n/l10n_util_mac.h" | 36 #include "ui/base/l10n/l10n_util_mac.h" |
37 #include "url/gurl.h" | 37 #include "url/gurl.h" |
38 | 38 |
39 #if !defined(__has_feature) || !__has_feature(objc_arc) | 39 #if !defined(__has_feature) || !__has_feature(objc_arc) |
40 #error "This file requires ARC support." | 40 #error "This file requires ARC support." |
41 #endif | 41 #endif |
42 | 42 |
43 using chrome_test_util::OpenLinkInNewTabButton; | 43 using chrome_test_util::OpenLinkInNewTabButton; |
| 44 using chrome_test_util::SettingsMenuButton; |
44 using tab_usage_recorder_test_util::OpenNewIncognitoTabUsingUIAndEvictMainTabs; | 45 using tab_usage_recorder_test_util::OpenNewIncognitoTabUsingUIAndEvictMainTabs; |
45 using tab_usage_recorder_test_util::SwitchToNormalMode; | 46 using tab_usage_recorder_test_util::SwitchToNormalMode; |
46 | 47 |
47 namespace { | 48 namespace { |
48 | 49 |
49 const char kTestUrl1[] = | 50 const char kTestUrl1[] = |
50 "http://ios/testing/data/http_server_files/memory_usage.html"; | 51 "http://ios/testing/data/http_server_files/memory_usage.html"; |
51 const char kURL1FirstWord[] = "Page"; | 52 const char kURL1FirstWord[] = "Page"; |
52 const char kTestUrl2[] = | 53 const char kTestUrl2[] = |
53 "http://ios/testing/data/http_server_files/fullscreen.html"; | 54 "http://ios/testing/data/http_server_files/fullscreen.html"; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 onElementWithMatcher:grey_accessibilityID(kSettingsCollectionViewId)] | 142 onElementWithMatcher:grey_accessibilityID(kSettingsCollectionViewId)] |
142 performAction:grey_tap()]; | 143 performAction:grey_tap()]; |
143 } | 144 } |
144 | 145 |
145 // Open the settings menu. Wait for the settings menu to appear. | 146 // Open the settings menu. Wait for the settings menu to appear. |
146 void OpenSettingsMenuUnsynced() { | 147 void OpenSettingsMenuUnsynced() { |
147 id<GREYMatcher> tool_menu_matcher = | 148 id<GREYMatcher> tool_menu_matcher = |
148 grey_accessibilityID(kToolbarToolsMenuButtonIdentifier); | 149 grey_accessibilityID(kToolbarToolsMenuButtonIdentifier); |
149 WaitAndTap(tool_menu_matcher, @"Tool menu"); | 150 WaitAndTap(tool_menu_matcher, @"Tool menu"); |
150 | 151 |
151 id<GREYMatcher> settings_button_matcher = | 152 WaitAndTap(SettingsMenuButton(), @"Settings menu"); |
152 grey_accessibilityID(kToolsMenuSettingsId); | |
153 | |
154 WaitAndTap(settings_button_matcher, @"Settings menu"); | |
155 Wait(grey_accessibilityID(kSettingsCollectionViewId), @"Setting view"); | 153 Wait(grey_accessibilityID(kSettingsCollectionViewId), @"Setting view"); |
156 } | 154 } |
157 | 155 |
158 // Select the tab with title |title| using UI (tab strip on iPad, stack view on | 156 // Select the tab with title |title| using UI (tab strip on iPad, stack view on |
159 // iPhone). | 157 // iPhone). |
160 void SelectTabUsingUI(NSString* title) { | 158 void SelectTabUsingUI(NSString* title) { |
161 if (IsCompact()) { | 159 if (IsCompact()) { |
162 WaitAndTap(chrome_test_util::ShowTabsButton(), @"Tab switcher"); | 160 WaitAndTap(chrome_test_util::ShowTabsButton(), @"Tab switcher"); |
163 } | 161 } |
164 WaitAndTap(grey_text(title), | 162 WaitAndTap(grey_text(title), |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; | 833 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; |
836 } | 834 } |
837 // The deleted tabs are purged during foregrounding and backgrounding. | 835 // The deleted tabs are purged during foregrounding and backgrounding. |
838 chrome_test_util::SimulateTabsBackgrounding(); | 836 chrome_test_util::SimulateTabsBackgrounding(); |
839 // Make sure |evicted_tabs_| purged the deleted tabs. | 837 // Make sure |evicted_tabs_| purged the deleted tabs. |
840 int evicted = chrome_test_util::GetEvictedMainTabCount(); | 838 int evicted = chrome_test_util::GetEvictedMainTabCount(); |
841 GREYAssertEqual(evicted, 0, @"Check number of evicted tabs"); | 839 GREYAssertEqual(evicted, 0, @"Check number of evicted tabs"); |
842 } | 840 } |
843 | 841 |
844 @end | 842 @end |
OLD | NEW |