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

Side by Side Diff: chrome/browser/sessions/persistent_tab_restore_service_browsertest.cc

Issue 22363005: Switch BaseSessionService to use SequencedWorkerPool instead of FILE thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "chrome/browser/sessions/persistent_tab_restore_service.h" 5 #include "chrome/browser/sessions/persistent_tab_restore_service.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/threading/sequenced_worker_pool.h"
11 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/sessions/session_service.h" 14 #include "chrome/browser/sessions/session_service.h"
14 #include "chrome/browser/sessions/session_service_factory.h" 15 #include "chrome/browser/sessions/session_service_factory.h"
15 #include "chrome/browser/sessions/session_types.h" 16 #include "chrome/browser/sessions/session_types.h"
16 #include "chrome/browser/sessions/tab_restore_service_factory.h" 17 #include "chrome/browser/sessions/tab_restore_service_factory.h"
17 #include "chrome/browser/sessions/tab_restore_service_observer.h" 18 #include "chrome/browser/sessions/tab_restore_service_observer.h"
18 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
20 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 21 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 SessionService* session_service = new SessionService(profile()); 151 SessionService* session_service = new SessionService(profile());
151 SessionServiceFactory::SetForTestProfile(profile(), session_service); 152 SessionServiceFactory::SetForTestProfile(profile(), session_service);
152 153
153 AddWindowWithOneTabToSessionService(pinned); 154 AddWindowWithOneTabToSessionService(pinned);
154 155
155 // Set this, otherwise previous session won't be loaded. 156 // Set this, otherwise previous session won't be loaded.
156 profile()->set_last_session_exited_cleanly(false); 157 profile()->set_last_session_exited_cleanly(false);
157 } 158 }
158 159
159 void SynchronousLoadTabsFromLastSession() { 160 void SynchronousLoadTabsFromLastSession() {
161 content::BrowserThread::GetBlockingPool()->FlushForTesting();
160 // Ensures that the load is complete before continuing. 162 // Ensures that the load is complete before continuing.
161 service_->LoadTabsFromLastSession(); 163 service_->LoadTabsFromLastSession();
162 base::RunLoop().RunUntilIdle(); 164 base::RunLoop().RunUntilIdle();
163 } 165 }
164 166
165 GURL url1_; 167 GURL url1_;
166 GURL url2_; 168 GURL url2_;
167 GURL url3_; 169 GURL url3_;
168 std::string user_agent_override_; 170 std::string user_agent_override_;
169 scoped_ptr<PersistentTabRestoreService> service_; 171 scoped_ptr<PersistentTabRestoreService> service_;
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 744
743 EXPECT_FALSE(service_->IsLoaded()); 745 EXPECT_FALSE(service_->IsLoaded());
744 TestTabRestoreServiceObserver observer; 746 TestTabRestoreServiceObserver observer;
745 service_->AddObserver(&observer); 747 service_->AddObserver(&observer);
746 EXPECT_EQ(max_entries, service_->entries().size()); 748 EXPECT_EQ(max_entries, service_->entries().size());
747 SynchronousLoadTabsFromLastSession(); 749 SynchronousLoadTabsFromLastSession();
748 EXPECT_TRUE(observer.got_loaded()); 750 EXPECT_TRUE(observer.got_loaded());
749 EXPECT_TRUE(service_->IsLoaded()); 751 EXPECT_TRUE(service_->IsLoaded());
750 service_->RemoveObserver(&observer); 752 service_->RemoveObserver(&observer);
751 } 753 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698