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

Side by Side Diff: ios/web/web_state/ui/crw_web_controller_observer_unittest.mm

Issue 2933363002: [ObjC ARC] Converts ios/web:ios_web_web_state_ui_unittests to ARC. (Closed)
Patch Set: Review nits. Created 3 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/public/web_state/crw_web_controller_observer.h" 5 #import "ios/web/public/web_state/crw_web_controller_observer.h"
6 6
7 #import "base/mac/scoped_nsobject.h"
8 #import "ios/web/test/crw_fake_web_controller_observer.h" 7 #import "ios/web/test/crw_fake_web_controller_observer.h"
9 #import "ios/web/test/web_test_with_web_controller.h" 8 #import "ios/web/test/web_test_with_web_controller.h"
10 9
10 #if !defined(__has_feature) || !__has_feature(objc_arc)
11 #error "This file requires ARC support."
12 #endif
13
11 namespace web { 14 namespace web {
12 15
13 // Test fixture to test web controller observing. 16 // Test fixture to test web controller observing.
14 class CRWWebControllerObserverTest : public web::WebTestWithWebController { 17 class CRWWebControllerObserverTest : public web::WebTestWithWebController {
15 protected: 18 protected:
16 void SetUp() override { 19 void SetUp() override {
17 web::WebTestWithWebController::SetUp(); 20 web::WebTestWithWebController::SetUp();
18 fake_web_controller_observer_.reset( 21 fake_web_controller_observer_ = [[CRWFakeWebControllerObserver alloc] init];
19 [[CRWFakeWebControllerObserver alloc] init]);
20 [web_controller() addObserver:fake_web_controller_observer_]; 22 [web_controller() addObserver:fake_web_controller_observer_];
21 } 23 }
22 24
23 void TearDown() override { 25 void TearDown() override {
24 [web_controller() removeObserver:fake_web_controller_observer_]; 26 [web_controller() removeObserver:fake_web_controller_observer_];
25 fake_web_controller_observer_.reset(); 27 fake_web_controller_observer_ = nil;
26 web::WebTestWithWebController::TearDown(); 28 web::WebTestWithWebController::TearDown();
27 } 29 }
28 30
29 base::scoped_nsobject<CRWFakeWebControllerObserver> 31 CRWFakeWebControllerObserver* fake_web_controller_observer_;
30 fake_web_controller_observer_;
31 }; 32 };
32 33
33 TEST_F(CRWWebControllerObserverTest, PageLoaded) { 34 TEST_F(CRWWebControllerObserverTest, PageLoaded) {
34 EXPECT_FALSE([fake_web_controller_observer_ pageLoaded]); 35 EXPECT_FALSE([fake_web_controller_observer_ pageLoaded]);
35 LoadHtml(@"<p></p>"); 36 LoadHtml(@"<p></p>");
36 EXPECT_TRUE([fake_web_controller_observer_ pageLoaded]); 37 EXPECT_TRUE([fake_web_controller_observer_ pageLoaded]);
37 } 38 }
38 39
39 } // namespace web 40 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698