| Index: chrome/browser/sessions/tab_restore_service_browsertest.cc
|
| ===================================================================
|
| --- chrome/browser/sessions/tab_restore_service_browsertest.cc (revision 150796)
|
| +++ chrome/browser/sessions/tab_restore_service_browsertest.cc (working copy)
|
| @@ -16,13 +16,11 @@
|
| #include "chrome/test/base/chrome_render_view_test.h"
|
| #include "chrome/test/base/in_process_browser_test.h"
|
| #include "chrome/test/base/testing_profile.h"
|
| -#include "content/public/browser/browser_thread.h"
|
| #include "content/public/browser/navigation_controller.h"
|
| #include "content/public/browser/navigation_entry.h"
|
| #include "content/public/browser/notification_service.h"
|
| #include "content/public/browser/notification_types.h"
|
| #include "content/public/test/render_view_test.h"
|
| -#include "content/public/test/test_browser_thread.h"
|
| #include "content/public/test/test_utils.h"
|
| #include "content/public/test/web_contents_tester.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -52,8 +50,7 @@
|
|
|
| class TabRestoreServiceTest : public ChromeRenderViewHostTestHarness {
|
| public:
|
| - TabRestoreServiceTest()
|
| - : ui_thread_(content::BrowserThread::UI, &message_loop_) {
|
| + TabRestoreServiceTest() {
|
| url1_ = GURL("http://1");
|
| url2_ = GURL("http://2");
|
| url3_ = GURL("http://3");
|
| @@ -143,14 +140,13 @@
|
| TabRestoreTimeFactory* time_factory_;
|
| content::RenderViewTest::RendererWebKitPlatformSupportImplNoSandbox
|
| webkit_platform_support_;
|
| - content::TestBrowserThread ui_thread_;
|
| };
|
|
|
| TEST_F(TabRestoreServiceTest, Basic) {
|
| AddThreeNavigations();
|
|
|
| // Have the service record the tab.
|
| - service_->CreateHistoricalTab(contents(), -1);
|
| + service_->CreateHistoricalTab(&controller(), -1);
|
|
|
| // Make sure an entry was created.
|
| ASSERT_EQ(1U, service_->entries().size());
|
| @@ -172,7 +168,7 @@
|
| NavigateToIndex(1);
|
|
|
| // And check again.
|
| - service_->CreateHistoricalTab(contents(), -1);
|
| + service_->CreateHistoricalTab(&controller(), -1);
|
|
|
| // There should be two entries now.
|
| ASSERT_EQ(2U, service_->entries().size());
|
| @@ -194,7 +190,7 @@
|
| // Make sure TabRestoreService doesn't create an entry for a tab with no
|
| // navigations.
|
| TEST_F(TabRestoreServiceTest, DontCreateEmptyTab) {
|
| - service_->CreateHistoricalTab(contents(), -1);
|
| + service_->CreateHistoricalTab(&controller(), -1);
|
| EXPECT_TRUE(service_->entries().empty());
|
| }
|
|
|
| @@ -203,7 +199,7 @@
|
| AddThreeNavigations();
|
|
|
| // Have the service record the tab.
|
| - service_->CreateHistoricalTab(contents(), -1);
|
| + service_->CreateHistoricalTab(&controller(), -1);
|
|
|
| // Recreate the service and have it load the tabs.
|
| RecreateService();
|
| @@ -230,7 +226,7 @@
|
| AddThreeNavigations();
|
|
|
| // Have the service record the tab.
|
| - service_->CreateHistoricalTab(contents(), -1);
|
| + service_->CreateHistoricalTab(&controller(), -1);
|
|
|
| // One entry should be created.
|
| ASSERT_EQ(1U, service_->entries().size());
|
| @@ -300,7 +296,7 @@
|
| controller().GetEntryAtIndex(2)->SetHasPostData(true);
|
|
|
| // Have the service record the tab.
|
| - service_->CreateHistoricalTab(contents(), -1);
|
| + service_->CreateHistoricalTab(&controller(), -1);
|
| ASSERT_EQ(1U, service_->entries().size());
|
|
|
| // Recreate the service and have it load the tabs.
|
| @@ -327,7 +323,7 @@
|
| AddThreeNavigations();
|
|
|
| // Have the service record the tab.
|
| - service_->CreateHistoricalTab(contents(), -1);
|
| + service_->CreateHistoricalTab(&controller(), -1);
|
| ASSERT_EQ(1U, service_->entries().size());
|
|
|
| // Recreate the service and have it load the tabs.
|
| @@ -400,7 +396,7 @@
|
|
|
| AddThreeNavigations();
|
|
|
| - service_->CreateHistoricalTab(contents(), -1);
|
| + service_->CreateHistoricalTab(&controller(), -1);
|
|
|
| RecreateService();
|
|
|
| @@ -443,7 +439,7 @@
|
|
|
| AddThreeNavigations();
|
|
|
| - service_->CreateHistoricalTab(contents(), -1);
|
| + service_->CreateHistoricalTab(&controller(), -1);
|
|
|
| RecreateService();
|
|
|
| @@ -487,7 +483,7 @@
|
|
|
| AddThreeNavigations();
|
|
|
| - service_->CreateHistoricalTab(contents(), -1);
|
| + service_->CreateHistoricalTab(&controller(), -1);
|
|
|
| RecreateService();
|
|
|
| @@ -516,7 +512,7 @@
|
| AddThreeNavigations();
|
|
|
| // Have the service record the tab.
|
| - service_->CreateHistoricalTab(contents(), -1);
|
| + service_->CreateHistoricalTab(&controller(), -1);
|
|
|
| // Make sure an entry was created.
|
| ASSERT_EQ(1U, service_->entries().size());
|
| @@ -644,7 +640,7 @@
|
| const size_t max_entries = TabRestoreService::kMaxEntries;
|
| for (size_t i = 0; i < max_entries + 5; i++) {
|
| NavigateAndCommit(GURL(StringPrintf("http://%d", static_cast<int>(i))));
|
| - service_->CreateHistoricalTab(contents(), -1);
|
| + service_->CreateHistoricalTab(&controller(), -1);
|
| }
|
|
|
| EXPECT_EQ(max_entries, service_->entries_.size());
|
|
|