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 "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 NSString* tryAgainPrimaryAction = | 48 NSString* tryAgainPrimaryAction = |
49 [tryAgain uppercaseStringWithLocale:[NSLocale currentLocale]]; | 49 [tryAgain uppercaseStringWithLocale:[NSLocale currentLocale]]; |
50 id<GREYMatcher> tryAgainMatcher = | 50 id<GREYMatcher> tryAgainMatcher = |
51 [GREYMatchers matcherForButtonTitle:tryAgainPrimaryAction]; | 51 [GREYMatchers matcherForButtonTitle:tryAgainPrimaryAction]; |
52 [[EarlGrey selectElementWithMatcher:tryAgainMatcher] | 52 [[EarlGrey selectElementWithMatcher:tryAgainMatcher] |
53 assertWithMatcher:grey_notNil()]; | 53 assertWithMatcher:grey_notNil()]; |
54 } | 54 } |
55 | 55 |
56 } // namespace | 56 } // namespace |
57 | 57 |
| 58 // Expose internal class methods for swizzling. |
| 59 @interface SafeModeViewController (Testing) |
| 60 + (BOOL)detectedThirdPartyMods; |
| 61 + (BOOL)hasReportToUpload; |
| 62 - (NSArray*)startupCrashModules; |
| 63 @end |
| 64 |
58 // Tests the display of Safe Mode Controller under different error states of | 65 // Tests the display of Safe Mode Controller under different error states of |
59 // jailbroken-ness and whether a crash dump was saved. | 66 // jailbroken-ness and whether a crash dump was saved. |
60 @interface SafeModeTestCase : ChromeTestCase | 67 @interface SafeModeTestCase : ChromeTestCase |
61 @end | 68 @end |
62 | 69 |
63 @implementation SafeModeTestCase | 70 @implementation SafeModeTestCase |
64 | 71 |
65 // Tests that Safe Mode crash upload screen is displayed when there are crash | 72 // Tests that Safe Mode crash upload screen is displayed when there are crash |
66 // reports to upload. | 73 // reports to upload. |
67 - (void)testSafeModeSendingCrashReport { | 74 - (void)testSafeModeSendingCrashReport { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 NSString* message = | 158 NSString* message = |
152 [NSLocalizedString(@"IDS_IOS_SAFE_MODE_NAMED_TWEAKS_FOUND", @"") | 159 [NSLocalizedString(@"IDS_IOS_SAFE_MODE_NAMED_TWEAKS_FOUND", @"") |
153 stringByAppendingString:@"\n\n iAmBad\n MJackson"]; | 160 stringByAppendingString:@"\n\n iAmBad\n MJackson"]; |
154 AssertMessageOnPage(message); | 161 AssertMessageOnPage(message); |
155 AssertTryAgainButtonOnPage(); | 162 AssertTryAgainButtonOnPage(); |
156 AssertMessageNotOnPage( | 163 AssertMessageNotOnPage( |
157 NSLocalizedString(@"IDS_IOS_SAFE_MODE_SENDING_CRASH_REPORT", @"")); | 164 NSLocalizedString(@"IDS_IOS_SAFE_MODE_SENDING_CRASH_REPORT", @"")); |
158 } | 165 } |
159 | 166 |
160 @end | 167 @end |
OLD | NEW |