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

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

Issue 2726713002: Allow creation of CRWSessionStorage outside of serialisation API. (Closed)
Patch Set: Rebase. Created 3 years, 9 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 | « no previous file | ios/web/navigation/serializable_user_data_manager_impl.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 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 <objc/runtime.h> 5 #import <objc/runtime.h>
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/mac/scoped_nsautorelease_pool.h" 8 #include "base/mac/scoped_nsautorelease_pool.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/strings/sys_string_conversions.h" 11 #include "base/strings/sys_string_conversions.h"
12 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" 12 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
13 #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h" 13 #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h"
14 #include "ios/chrome/browser/chrome_url_constants.h" 14 #include "ios/chrome/browser/chrome_url_constants.h"
15 #include "ios/chrome/browser/infobars/infobar_manager_impl.h" 15 #include "ios/chrome/browser/infobars/infobar_manager_impl.h"
16 #include "ios/chrome/browser/sessions/ios_chrome_session_tab_helper.h" 16 #include "ios/chrome/browser/sessions/ios_chrome_session_tab_helper.h"
17 #import "ios/chrome/browser/sessions/session_window.h" 17 #import "ios/chrome/browser/sessions/session_window.h"
18 #import "ios/chrome/browser/sessions/test_session_service.h" 18 #import "ios/chrome/browser/sessions/test_session_service.h"
19 #import "ios/chrome/browser/tabs/tab.h" 19 #import "ios/chrome/browser/tabs/tab.h"
20 #import "ios/chrome/browser/tabs/tab_model.h" 20 #import "ios/chrome/browser/tabs/tab_model.h"
21 #import "ios/chrome/browser/tabs/tab_model_observer.h" 21 #import "ios/chrome/browser/tabs/tab_model_observer.h"
22 #import "ios/chrome/browser/tabs/tab_private.h" 22 #import "ios/chrome/browser/tabs/tab_private.h"
23 #import "ios/chrome/browser/web/chrome_web_client.h" 23 #import "ios/chrome/browser/web/chrome_web_client.h"
24 #include "ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_state_manager .h" 24 #include "ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_state_manager .h"
25 #import "ios/web/navigation/crw_session_controller.h" 25 #import "ios/web/navigation/crw_session_controller.h"
26 #import "ios/web/navigation/navigation_manager_impl.h" 26 #import "ios/web/navigation/navigation_manager_impl.h"
27 #import "ios/web/public/crw_session_storage.h"
27 #import "ios/web/public/navigation_manager.h" 28 #import "ios/web/public/navigation_manager.h"
28 #include "ios/web/public/referrer.h" 29 #include "ios/web/public/referrer.h"
29 #import "ios/web/public/serializable_user_data_manager.h" 30 #import "ios/web/public/serializable_user_data_manager.h"
30 #include "ios/web/public/test/scoped_testing_web_client.h" 31 #include "ios/web/public/test/scoped_testing_web_client.h"
31 #include "ios/web/public/test/test_web_thread_bundle.h" 32 #include "ios/web/public/test/test_web_thread_bundle.h"
32 #include "ios/web/public/web_thread.h" 33 #include "ios/web/public/web_thread.h"
33 #import "ios/web/web_state/ui/crw_web_controller.h" 34 #import "ios/web/web_state/ui/crw_web_controller.h"
34 #import "ios/web/web_state/web_state_impl.h" 35 #import "ios/web/web_state/web_state_impl.h"
35 #include "testing/gtest/include/gtest/gtest.h" 36 #include "testing/gtest/include/gtest/gtest.h"
36 #include "testing/gtest_mac.h" 37 #include "testing/gtest_mac.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 145
145 void RestoreSession(SessionWindowIOS* window) { 146 void RestoreSession(SessionWindowIOS* window) {
146 [tab_model_ restoreSessionWindow:window]; 147 [tab_model_ restoreSessionWindow:window];
147 } 148 }
148 149
149 // Creates a session window with |entries| entries and a |selectedIndex| of 1. 150 // Creates a session window with |entries| entries and a |selectedIndex| of 1.
150 SessionWindowIOS* CreateSessionWindow(int entries) { 151 SessionWindowIOS* CreateSessionWindow(int entries) {
151 SessionWindowIOS* window = [[SessionWindowIOS alloc] init]; 152 SessionWindowIOS* window = [[SessionWindowIOS alloc] init];
152 for (int i = 0; i < entries; i++) { 153 for (int i = 0; i < entries; i++) {
153 CRWSessionStorage* session_storage = 154 CRWSessionStorage* session_storage =
154 CreateWebState()->BuildSessionStorage(); 155 [[[CRWSessionStorage alloc] init] autorelease];
155 [window addSerializedSessionStorage:session_storage]; 156 [window addSerializedSessionStorage:session_storage];
156 } 157 }
157 if (entries) 158 if (entries)
158 [window setSelectedIndex:1]; 159 [window setSelectedIndex:1];
159 return window; 160 return window;
160 } 161 }
161 162
162 web::TestWebThreadBundle thread_bundle_; 163 web::TestWebThreadBundle thread_bundle_;
163 IOSChromeScopedTestingChromeBrowserStateManager scoped_browser_state_manager_; 164 IOSChromeScopedTestingChromeBrowserStateManager scoped_browser_state_manager_;
164 web::ScopedTestingWebClient web_client_; 165 web::ScopedTestingWebClient web_client_;
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 // Restoring TabModel session sends asynchronous tasks to IO thread, wait 810 // Restoring TabModel session sends asynchronous tasks to IO thread, wait
810 // for them to complete after destroying the TabModel. 811 // for them to complete after destroying the TabModel.
811 base::RunLoop().RunUntilIdle(); 812 base::RunLoop().RunUntilIdle();
812 813
813 // Clean up. 814 // Clean up.
814 EXPECT_TRUE([[NSFileManager defaultManager] removeItemAtPath:stashPath 815 EXPECT_TRUE([[NSFileManager defaultManager] removeItemAtPath:stashPath
815 error:nullptr]); 816 error:nullptr]);
816 } 817 }
817 818
818 } // anonymous namespace 819 } // anonymous namespace
OLDNEW
« no previous file with comments | « no previous file | ios/web/navigation/serializable_user_data_manager_impl.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698