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

Side by Side Diff: ios/web/crw_browsing_data_store_unittest.mm

Issue 1215433003: CL for Objective-C readability (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years, 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/crw_browsing_data_store.h" 5 #import "ios/web/public/crw_browsing_data_store.h"
6 6
7 #include "base/ios/ios_util.h" 7 #include "base/ios/ios_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #import "base/mac/scoped_nsobject.h" 9 #import "base/mac/scoped_nsobject.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #import "base/test/ios/wait_util.h" 11 #import "base/test/ios/wait_util.h"
12 #include "ios/web/public/active_state_manager.h" 12 #include "ios/web/public/active_state_manager.h"
13 #include "ios/web/public/browser_state.h" 13 #include "ios/web/public/browser_state.h"
14 #include "ios/web/public/test/test_browser_state.h" 14 #include "ios/web/public/test/test_browser_state.h"
15 #include "ios/web/public/test/test_web_thread_bundle.h" 15 #include "ios/web/public/test/test_web_thread_bundle.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "testing/platform_test.h" 17 #include "testing/platform_test.h"
18 18
19 // An observer to observe the |mode| key changes to a CRWBrowsingDataStore. 19 // An observer to observe the |mode| key changes to a CRWBrowsingDataStore.
20 // Used for testing purposes. 20 // Used for testing purposes.
21 @interface CRWTestBrowsingDataStoreObserver : NSObject 21 @interface CRWTestBrowsingDataStoreObserver : NSObject
22 // Designated init. |browsingDataStore| cannot be null. 22 // Designated init. |browsingDataStore| cannot be null.
23 - (instancetype)initWithBrowsingDataStore: 23 - (instancetype)initWithBrowsingDataStore:
24 (CRWBrowsingDataStore*)browsingDataStore NS_DESIGNATED_INITIALIZER; 24 (CRWBrowsingDataStore*)browsingDataStore NS_DESIGNATED_INITIALIZER;
stuartmorgan 2015/06/30 21:57:18 Only indent 4
shreyasv1 2015/07/07 21:42:05 Done.
25 - (instancetype)init NS_UNAVAILABLE; 25 - (instancetype)init NS_UNAVAILABLE;
26 // The number of times that the mode of the underlying CRWBrowsingDataStore 26 // The number of times that the mode of the underlying CRWBrowsingDataStore
27 // changed. 27 // changed.
28 @property(nonatomic, assign) NSUInteger modeChangeCount; 28 @property(nonatomic, assign) NSUInteger modeChangeCount;
29 @end 29 @end
30 30
31 @implementation CRWTestBrowsingDataStoreObserver { 31 @implementation CRWTestBrowsingDataStoreObserver {
32 // The underlying CRWBrowsingDataStore. 32 // The underlying CRWBrowsingDataStore.
33 __weak CRWBrowsingDataStore* _browsingDataStore; 33 __weak CRWBrowsingDataStore* _browsingDataStore;
34 } 34 }
35 35
36 @synthesize modeChangeCount = _modeChangeCount; 36 @synthesize modeChangeCount = _modeChangeCount;
37 37
38 - (instancetype)initWithBrowsingDataStore: 38 - (instancetype)initWithBrowsingDataStore:
39 (CRWBrowsingDataStore*)browsingDataStore { 39 (CRWBrowsingDataStore*)browsingDataStore {
stuartmorgan 2015/06/30 21:57:18 Same
shreyasv1 2015/07/07 21:42:05 Done.
40 self = [super init]; 40 self = [super init];
41 if (self) { 41 if (self) {
42 DCHECK(browsingDataStore); 42 DCHECK(browsingDataStore);
43 [browsingDataStore addObserver:self 43 [browsingDataStore addObserver:self
44 forKeyPath:@"mode" 44 forKeyPath:@"mode"
45 options:0 45 options:0
46 context:nil]; 46 context:nil];
47 _browsingDataStore = browsingDataStore; 47 _browsingDataStore = browsingDataStore;
48 } 48 }
49 return self; 49 return self;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 ASSERT_EQ(ACTIVE, [browsing_data_store_ mode]); 238 ASSERT_EQ(ACTIVE, [browsing_data_store_ mode]);
239 239
240 [browsing_data_store_ makeInactiveWithCompletionHandler:nil]; 240 [browsing_data_store_ makeInactiveWithCompletionHandler:nil];
241 // |removeDataOfTypes| is called immediately after a |makeInactive| call. 241 // |removeDataOfTypes| is called immediately after a |makeInactive| call.
242 RemoveDataOfTypes(BROWSING_DATA_TYPE_COOKIES); 242 RemoveDataOfTypes(BROWSING_DATA_TYPE_COOKIES);
243 EXPECT_EQ(INACTIVE, [browsing_data_store_ mode]); 243 EXPECT_EQ(INACTIVE, [browsing_data_store_ mode]);
244 } 244 }
245 245
246 } // namespace web 246 } // namespace web
247
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698