Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: ios/web/shell/test/earl_grey/shell_base_test_case.mm

Issue 2642193012: Make EarlGrey matchers compliant with Chromium style. (Closed)
Patch Set: build.gn and rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/web/shell/test/earl_grey/shell_base_test_case.h" 5 #import "ios/web/shell/test/earl_grey/shell_base_test_case.h"
6 6
7 #import <EarlGrey/EarlGrey.h> 7 #import <EarlGrey/EarlGrey.h>
8 8
9 #import "ios/web/public/test/http_server.h" 9 #import "ios/web/public/test/http_server.h"
10 #import "ios/web/shell/test/earl_grey/shell_matchers.h" 10 #import "ios/web/shell/test/earl_grey/shell_matchers.h"
11 11
12 #if !defined(__has_feature) || !__has_feature(objc_arc) 12 #if !defined(__has_feature) || !__has_feature(objc_arc)
13 #error "This file requires ARC support." 13 #error "This file requires ARC support."
14 #endif 14 #endif
15 15
16 using web::test::HttpServer; 16 using web::test::HttpServer;
17 using web::webViewContainingText; 17 using web::WebViewContainingText;
18 18
19 @implementation ShellBaseTestCase 19 @implementation ShellBaseTestCase
20 20
21 // Overrides |testInvocations| to skip all tests if a system alert view is 21 // Overrides |testInvocations| to skip all tests if a system alert view is
22 // shown, since this isn't a case a user would encounter (i.e. they would 22 // shown, since this isn't a case a user would encounter (i.e. they would
23 // dismiss the alert first). 23 // dismiss the alert first).
24 + (NSArray*)testInvocations { 24 + (NSArray*)testInvocations {
25 // TODO(crbug.com/654085): Simply skipping all tests isn't the best way to 25 // TODO(crbug.com/654085): Simply skipping all tests isn't the best way to
26 // handle this, it would be better to have something that is more obvious 26 // handle this, it would be better to have something that is more obvious
27 // on the bots that this is wrong, without making it look like test flake. 27 // on the bots that this is wrong, without making it look like test flake.
28 NSError* error = nil; 28 NSError* error = nil;
29 [[EarlGrey selectElementWithMatcher:grey_systemAlertViewShown()] 29 [[EarlGrey selectElementWithMatcher:grey_systemAlertViewShown()]
30 assertWithMatcher:grey_nil() 30 assertWithMatcher:grey_nil()
31 error:&error]; 31 error:&error];
32 if (error != nil) { 32 if (error != nil) {
33 NSLog(@"System alert view is present, so skipping all tests!"); 33 NSLog(@"System alert view is present, so skipping all tests!");
34 return @[]; 34 return @[];
35 } 35 }
36 return [super testInvocations]; 36 return [super testInvocations];
37 } 37 }
38 38
39 // Set up called once for the class. 39 // Set up called once for the class.
40 + (void)setUp { 40 + (void)setUp {
41 [super setUp]; 41 [super setUp];
42 [[EarlGrey selectElementWithMatcher:webViewContainingText("Chromium")] 42 [[EarlGrey selectElementWithMatcher:WebViewContainingText("Chromium")]
43 assertWithMatcher:grey_notNil()]; 43 assertWithMatcher:grey_notNil()];
44 HttpServer::GetSharedInstance().StartOrDie(); 44 HttpServer::GetSharedInstance().StartOrDie();
45 } 45 }
46 46
47 // Tear down called once for the class. 47 // Tear down called once for the class.
48 + (void)tearDown { 48 + (void)tearDown {
49 HttpServer::GetSharedInstance().Stop(); 49 HttpServer::GetSharedInstance().Stop();
50 [super tearDown]; 50 [super tearDown];
51 } 51 }
52 52
53 // Tear down called after each test. 53 // Tear down called after each test.
54 - (void)tearDown { 54 - (void)tearDown {
55 HttpServer::GetSharedInstance().RemoveAllResponseProviders(); 55 HttpServer::GetSharedInstance().RemoveAllResponseProviders();
56 [super tearDown]; 56 [super tearDown];
57 } 57 }
58 58
59 @end 59 @end
OLDNEW
« no previous file with comments | « ios/web/shell/test/context_menu_egtest.mm ('k') | ios/web/shell/test/earl_grey/shell_matchers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698