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

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

Issue 1171203004: Correct iOS build for latest Xcode beta. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 5 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
« no previous file with comments | « ios/web/crw_browsing_data_store.mm ('k') | ios/web/net/clients/crw_redirect_network_client.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
25 - (instancetype)init NS_UNAVAILABLE;
25 // The number of times that the mode of the underlying CRWBrowsingDataStore 26 // The number of times that the mode of the underlying CRWBrowsingDataStore
26 // changed. 27 // changed.
27 @property(nonatomic, assign) NSUInteger modeChangeCount; 28 @property(nonatomic, assign) NSUInteger modeChangeCount;
28 @end 29 @end
29 30
30 @implementation CRWTestBrowsingDataStoreObserver { 31 @implementation CRWTestBrowsingDataStoreObserver {
31 // The underlying CRWBrowsingDataStore. 32 // The underlying CRWBrowsingDataStore.
32 __weak CRWBrowsingDataStore* _browsingDataStore; 33 __weak CRWBrowsingDataStore* _browsingDataStore;
33 } 34 }
34 35
35 @synthesize modeChangeCount = _modeChangeCount; 36 @synthesize modeChangeCount = _modeChangeCount;
36 37
37 - (instancetype)initWithBrowsingDataStore: 38 - (instancetype)initWithBrowsingDataStore:
38 (CRWBrowsingDataStore*)browsingDataStore { 39 (CRWBrowsingDataStore*)browsingDataStore {
39 self = [super init]; 40 self = [super init];
40 if (self) { 41 if (self) {
41 DCHECK(browsingDataStore); 42 DCHECK(browsingDataStore);
42 [browsingDataStore addObserver:self 43 [browsingDataStore addObserver:self
43 forKeyPath:@"mode" 44 forKeyPath:@"mode"
44 options:0 45 options:0
45 context:nil]; 46 context:nil];
46 _browsingDataStore = browsingDataStore; 47 _browsingDataStore = browsingDataStore;
47 } 48 }
48 return self; 49 return self;
49 } 50 }
50 51
52 - (instancetype)init {
53 NOTREACHED();
54 return nil;
55 }
56
51 - (void)observeValueForKeyPath:(NSString*)keyPath 57 - (void)observeValueForKeyPath:(NSString*)keyPath
52 ofObject:(id)object 58 ofObject:(id)object
53 change:(NSDictionary*)change 59 change:(NSDictionary*)change
54 context:(void*)context { 60 context:(void*)context {
55 DCHECK([keyPath isEqual:@"mode"]); 61 DCHECK([keyPath isEqual:@"mode"]);
56 DCHECK_EQ(_browsingDataStore, object); 62 DCHECK_EQ(_browsingDataStore, object);
57 63
58 ++self.modeChangeCount; 64 ++self.modeChangeCount;
59 } 65 }
60 66
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 237
232 ASSERT_EQ(ACTIVE, [browsing_data_store_ mode]); 238 ASSERT_EQ(ACTIVE, [browsing_data_store_ mode]);
233 239
234 [browsing_data_store_ makeInactiveWithCompletionHandler:nil]; 240 [browsing_data_store_ makeInactiveWithCompletionHandler:nil];
235 // |removeDataOfTypes| is called immediately after a |makeInactive| call. 241 // |removeDataOfTypes| is called immediately after a |makeInactive| call.
236 RemoveDataOfTypes(BROWSING_DATA_TYPE_COOKIES); 242 RemoveDataOfTypes(BROWSING_DATA_TYPE_COOKIES);
237 EXPECT_EQ(INACTIVE, [browsing_data_store_ mode]); 243 EXPECT_EQ(INACTIVE, [browsing_data_store_ mode]);
238 } 244 }
239 245
240 } // namespace web 246 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/crw_browsing_data_store.mm ('k') | ios/web/net/clients/crw_redirect_network_client.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698