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

Side by Side Diff: ios/chrome/browser/tabs/tab_unittest.mm

Issue 2628273004: Revert of Use ChromeBrowserStateManager instead of BrowserListIOS. (Closed)
Patch Set: 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
« no previous file with comments | « ios/chrome/browser/tabs/tab_model_unittest.mm ('k') | ios/chrome/browser/ui/BUILD.gn » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 <UIKit/UIKit.h> 5 #import <UIKit/UIKit.h>
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_path.h"
11 #include "base/ios/block_types.h" 10 #include "base/ios/block_types.h"
12 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
13 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
14 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
15 #include "base/run_loop.h" 14 #include "base/run_loop.h"
16 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
17 #include "base/strings/sys_string_conversions.h" 16 #include "base/strings/sys_string_conversions.h"
18 #include "components/bookmarks/test/bookmark_test_helpers.h" 17 #include "components/bookmarks/test/bookmark_test_helpers.h"
19 #include "components/history/core/browser/history_service.h" 18 #include "components/history/core/browser/history_service.h"
20 #include "components/keyed_service/core/service_access_type.h" 19 #include "components/keyed_service/core/service_access_type.h"
21 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" 20 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h"
22 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" 21 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
23 #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h"
24 #import "ios/chrome/browser/chrome_url_util.h" 22 #import "ios/chrome/browser/chrome_url_util.h"
25 #include "ios/chrome/browser/history/history_service_factory.h" 23 #include "ios/chrome/browser/history/history_service_factory.h"
26 #import "ios/chrome/browser/tabs/tab.h" 24 #import "ios/chrome/browser/tabs/tab.h"
27 #import "ios/chrome/browser/tabs/tab_model.h" 25 #import "ios/chrome/browser/tabs/tab_model.h"
28 #import "ios/chrome/browser/tabs/tab_private.h" 26 #import "ios/chrome/browser/tabs/tab_private.h"
29 #import "ios/chrome/browser/ui/open_in_controller.h" 27 #import "ios/chrome/browser/ui/open_in_controller.h"
30 #import "ios/chrome/browser/ui/open_in_controller_testing.h" 28 #import "ios/chrome/browser/ui/open_in_controller_testing.h"
31 #import "ios/chrome/browser/web/external_app_launcher.h" 29 #import "ios/chrome/browser/web/external_app_launcher.h"
32 #include "ios/chrome/test/block_cleanup_test.h" 30 #include "ios/chrome/test/block_cleanup_test.h"
33 #include "ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_provider.h" 31 #include "ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_provider.h"
34 #include "ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_state_manager .h"
35 #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" 32 #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h"
36 #import "ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_ metadata.h" 33 #import "ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_ metadata.h"
37 #import "ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_ whitelist_manager.h" 34 #import "ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_ whitelist_manager.h"
38 #include "ios/public/provider/chrome/browser/test_chrome_browser_provider.h" 35 #include "ios/public/provider/chrome/browser/test_chrome_browser_provider.h"
39 #import "ios/testing/ocmock_complex_type_helper.h" 36 #import "ios/testing/ocmock_complex_type_helper.h"
40 #import "ios/web/navigation/crw_session_controller.h" 37 #import "ios/web/navigation/crw_session_controller.h"
41 #import "ios/web/navigation/navigation_manager_impl.h" 38 #import "ios/web/navigation/navigation_manager_impl.h"
42 #include "ios/web/public/navigation_item.h" 39 #include "ios/web/public/navigation_item.h"
43 #import "ios/web/public/navigation_manager.h" 40 #import "ios/web/public/navigation_manager.h"
44 #include "ios/web/public/referrer.h" 41 #include "ios/web/public/referrer.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 id<NativeAppWhitelistManager> GetNativeAppWhitelistManager() const override { 153 id<NativeAppWhitelistManager> GetNativeAppWhitelistManager() const override {
157 return manager_; 154 return manager_;
158 } 155 }
159 156
160 private: 157 private:
161 base::scoped_nsprotocol<id<NativeAppWhitelistManager>> manager_; 158 base::scoped_nsprotocol<id<NativeAppWhitelistManager>> manager_;
162 }; 159 };
163 160
164 class TabTest : public BlockCleanupTest { 161 class TabTest : public BlockCleanupTest {
165 public: 162 public:
166 TabTest() 163 TabTest() : thread_bundle_(web::TestWebThreadBundle::REAL_FILE_THREAD) {}
167 : thread_bundle_(web::TestWebThreadBundle::REAL_FILE_THREAD),
168 scoped_browser_state_manager_(
169 base::MakeUnique<TestChromeBrowserStateManager>(base::FilePath())) {
170 }
171 164
172 void SetUp() override { 165 void SetUp() override {
173 BlockCleanupTest::SetUp(); 166 BlockCleanupTest::SetUp();
174 167
175 [[ChromeAppConstants sharedInstance] 168 [[ChromeAppConstants sharedInstance]
176 setCallbackSchemeForTesting:@"chromium"]; 169 setCallbackSchemeForTesting:@"chromium"];
177 170
178 // Set up the testing profiles. 171 // Set up the testing profiles.
179 TestChromeBrowserState::Builder test_cbs_builder; 172 TestChromeBrowserState::Builder test_cbs_builder;
180 chrome_browser_state_ = test_cbs_builder.Build(); 173 chrome_browser_state_ = test_cbs_builder.Build();
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 NSLog(@"title = %@; url = %@", base::SysUTF16ToNSString(result->title()), 303 NSLog(@"title = %@; url = %@", base::SysUTF16ToNSString(result->title()),
311 base::SysUTF8ToNSString(result->url().spec())); 304 base::SysUTF8ToNSString(result->url().spec()));
312 } 305 }
313 } 306 }
314 #endif 307 #endif
315 308
316 virtual bool UseOffTheRecordBrowserState() const { return false; } 309 virtual bool UseOffTheRecordBrowserState() const { return false; }
317 310
318 protected: 311 protected:
319 web::TestWebThreadBundle thread_bundle_; 312 web::TestWebThreadBundle thread_bundle_;
320 IOSChromeScopedTestingChromeBrowserStateManager scoped_browser_state_manager_; 313 IOSChromeScopedTestingLocalState local_state_;
321 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; 314 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_;
322 base::scoped_nsobject<Tab> tab_; 315 base::scoped_nsobject<Tab> tab_;
323 history::HistoryService* history_service_; // weak 316 history::HistoryService* history_service_; // weak
324 CRWWebController* mock_web_controller_; // weak 317 CRWWebController* mock_web_controller_; // weak
325 base::scoped_nsobject<UIView> web_controller_view_; 318 base::scoped_nsobject<UIView> web_controller_view_;
326 base::scoped_nsobject<ArrayTabModel> tabModel_; 319 base::scoped_nsobject<ArrayTabModel> tabModel_;
327 base::scoped_nsobject<id> mock_external_app_launcher_; 320 base::scoped_nsobject<id> mock_external_app_launcher_;
328 }; 321 };
329 322
330 TEST_F(TabTest, AddToHistoryWithRedirect) { 323 TEST_F(TabTest, AddToHistoryWithRedirect) {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 base::scoped_nsobject<FakeNativeAppMetadata> metadata( 542 base::scoped_nsobject<FakeNativeAppMetadata> metadata(
550 [[FakeNativeAppMetadata alloc] init]); 543 [[FakeNativeAppMetadata alloc] init]);
551 544
552 // Turn auto open on. 545 // Turn auto open on.
553 [metadata setShouldAutoOpenLinks:YES]; 546 [metadata setShouldAutoOpenLinks:YES];
554 int expectedCallCount = 2; 547 int expectedCallCount = 2;
555 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); 548 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO);
556 EXPECT_FALSE([metadata shouldAutoOpenLinks]); 549 EXPECT_FALSE([metadata shouldAutoOpenLinks]);
557 } 550 }
558 551
552 class TestRequestGroupID : public BlockCleanupTest {
553 public:
554 void SetUp() override { BlockCleanupTest::SetUp(); }
555 void TearDown() override { BlockCleanupTest::TearDown(); }
556 };
557
559 } // namespace 558 } // namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/tab_model_unittest.mm ('k') | ios/chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698