| 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 "ios/chrome/test/earl_grey/chrome_test_case.h" | 5 #import "ios/chrome/test/earl_grey/chrome_test_case.h" |
| 6 | 6 |
| 7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
| 8 | 8 |
| 9 #import <EarlGrey/EarlGrey.h> | 9 #import <EarlGrey/EarlGrey.h> |
| 10 | 10 |
| 11 #include "base/mac/scoped_block.h" | 11 #include "base/mac/scoped_block.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
| 13 #import "ios/chrome/test/app/chrome_test_util.h" | 13 #import "ios/chrome/test/app/chrome_test_util.h" |
| 14 #include "ios/chrome/test/app/settings_test_util.h" | 14 #include "ios/chrome/test/app/settings_test_util.h" |
| 15 #include "ios/chrome/test/app/signin_test_util.h" | 15 #include "ios/chrome/test/app/signin_test_util.h" |
| 16 #import "ios/chrome/test/app/sync_test_util.h" | 16 #import "ios/chrome/test/app/sync_test_util.h" |
| 17 #import "ios/chrome/test/app/tab_test_util.h" | 17 #import "ios/chrome/test/app/tab_test_util.h" |
| 18 #import "ios/web/public/test/http_server.h" | 18 #import "ios/web/public/test/http_server.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 NSString* const kFlakyEarlGreyTestTargetSuffix = @"_flaky_egtests"; |
| 23 |
| 22 // Contains a list of test names that run in multitasking test suite. | 24 // Contains a list of test names that run in multitasking test suite. |
| 23 NSArray* whiteListedMultitaskingTests = @[ | 25 NSArray* whiteListedMultitaskingTests = @[ |
| 24 // Integration tests | 26 // Integration tests |
| 25 @"testContextMenuOpenInNewTab", // ContextMenuTestCase | 27 @"testContextMenuOpenInNewTab", // ContextMenuTestCase |
| 26 @"testSwitchToMain", // CookiesTestCase | 28 @"testSwitchToMain", // CookiesTestCase |
| 27 @"testSwitchToIncognito", // CookiesTestCase | 29 @"testSwitchToIncognito", // CookiesTestCase |
| 28 @"testFindDefaultFormAssistControls", // FormInputTestCase | 30 @"testFindDefaultFormAssistControls", // FormInputTestCase |
| 29 @"testTabDeletion", // TabUsageRecorderTestCase | 31 @"testTabDeletion", // TabUsageRecorderTestCase |
| 30 @"testAutoTranslate", // TranslateTestCase | 32 @"testAutoTranslate", // TranslateTestCase |
| 31 | 33 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 [[EarlGrey selectElementWithMatcher:grey_systemAlertViewShown()] | 109 [[EarlGrey selectElementWithMatcher:grey_systemAlertViewShown()] |
| 108 assertWithMatcher:grey_nil() | 110 assertWithMatcher:grey_nil() |
| 109 error:&error]; | 111 error:&error]; |
| 110 if (error != nil) { | 112 if (error != nil) { |
| 111 NSLog(@"System alert view is present, so skipping all tests!"); | 113 NSLog(@"System alert view is present, so skipping all tests!"); |
| 112 return @[]; | 114 return @[]; |
| 113 } | 115 } |
| 114 | 116 |
| 115 // Return specific list of tests based on the target. | 117 // Return specific list of tests based on the target. |
| 116 NSString* targetName = [NSBundle mainBundle].infoDictionary[@"CFBundleName"]; | 118 NSString* targetName = [NSBundle mainBundle].infoDictionary[@"CFBundleName"]; |
| 117 if ([targetName isEqualToString:@"ios_chrome_flaky_egtests"]) { | 119 if ([targetName hasSuffix:kFlakyEarlGreyTestTargetSuffix]) { |
| 118 // Only run FLAKY_ tests for the flaky test suite. | 120 // Only run FLAKY_ tests for flaky test suites. |
| 119 return [self flakyTestNames]; | 121 return [self flakyTestNames]; |
| 120 } else if ([targetName isEqualToString:@"ios_chrome_multitasking_egtests"]) { | 122 } else if ([targetName isEqualToString:@"ios_chrome_multitasking_egtests"]) { |
| 121 // Only run white listed tests for the multitasking test suite. | 123 // Only run white listed tests for the multitasking test suite. |
| 122 return [self multitaskingTestNames]; | 124 return [self multitaskingTestNames]; |
| 123 } else { | 125 } else { |
| 124 return [super testInvocations]; | 126 return [super testInvocations]; |
| 125 } | 127 } |
| 126 } | 128 } |
| 127 | 129 |
| 128 // Set up called once for the class, to dismiss anything displayed on startup | 130 // Set up called once for the class, to dismiss anything displayed on startup |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 [NSInvocation invocationWithMethodSignature:methodSignature]; | 290 [NSInvocation invocationWithMethodSignature:methodSignature]; |
| 289 invocation.selector = selector; | 291 invocation.selector = selector; |
| 290 [multitaskingTestNames addObject:invocation]; | 292 [multitaskingTestNames addObject:invocation]; |
| 291 } | 293 } |
| 292 } | 294 } |
| 293 free(methods); | 295 free(methods); |
| 294 return multitaskingTestNames; | 296 return multitaskingTestNames; |
| 295 } | 297 } |
| 296 | 298 |
| 297 @end | 299 @end |
| OLD | NEW |