| Index: chrome/browser/sessions/tab_restore_service_browsertest.cc
|
| ===================================================================
|
| --- chrome/browser/sessions/tab_restore_service_browsertest.cc (revision 151481)
|
| +++ chrome/browser/sessions/tab_restore_service_browsertest.cc (working copy)
|
| @@ -16,11 +16,13 @@
|
| #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"
|
| @@ -50,7 +52,8 @@
|
|
|
| class TabRestoreServiceTest : public ChromeRenderViewHostTestHarness {
|
| public:
|
| - TabRestoreServiceTest() {
|
| + TabRestoreServiceTest()
|
| + : ui_thread_(content::BrowserThread::UI, &message_loop_) {
|
| url1_ = GURL("http://1");
|
| url2_ = GURL("http://2");
|
| url3_ = GURL("http://3");
|
| @@ -140,13 +143,14 @@
|
| 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(&controller(), -1);
|
| + service_->CreateHistoricalTab(contents(), -1);
|
|
|
| // Make sure an entry was created.
|
| ASSERT_EQ(1U, service_->entries().size());
|
| @@ -168,7 +172,7 @@
|
| NavigateToIndex(1);
|
|
|
| // And check again.
|
| - service_->CreateHistoricalTab(&controller(), -1);
|
| + service_->CreateHistoricalTab(contents(), -1);
|
|
|
| // There should be two entries now.
|
| ASSERT_EQ(2U, service_->entries().size());
|
| @@ -190,7 +194,7 @@
|
| // Make sure TabRestoreService doesn't create an entry for a tab with no
|
| // navigations.
|
| TEST_F(TabRestoreServiceTest, DontCreateEmptyTab) {
|
| - service_->CreateHistoricalTab(&controller(), -1);
|
| + service_->CreateHistoricalTab(contents(), -1);
|
| EXPECT_TRUE(service_->entries().empty());
|
| }
|
|
|
| @@ -199,7 +203,7 @@
|
| AddThreeNavigations();
|
|
|
| // Have the service record the tab.
|
| - service_->CreateHistoricalTab(&controller(), -1);
|
| + service_->CreateHistoricalTab(contents(), -1);
|
|
|
| // Recreate the service and have it load the tabs.
|
| RecreateService();
|
| @@ -226,7 +230,7 @@
|
| AddThreeNavigations();
|
|
|
| // Have the service record the tab.
|
| - service_->CreateHistoricalTab(&controller(), -1);
|
| + service_->CreateHistoricalTab(contents(), -1);
|
|
|
| // One entry should be created.
|
| ASSERT_EQ(1U, service_->entries().size());
|
| @@ -296,7 +300,7 @@
|
| controller().GetEntryAtIndex(2)->SetHasPostData(true);
|
|
|
| // Have the service record the tab.
|
| - service_->CreateHistoricalTab(&controller(), -1);
|
| + service_->CreateHistoricalTab(contents(), -1);
|
| ASSERT_EQ(1U, service_->entries().size());
|
|
|
| // Recreate the service and have it load the tabs.
|
| @@ -323,7 +327,7 @@
|
| AddThreeNavigations();
|
|
|
| // Have the service record the tab.
|
| - service_->CreateHistoricalTab(&controller(), -1);
|
| + service_->CreateHistoricalTab(contents(), -1);
|
| ASSERT_EQ(1U, service_->entries().size());
|
|
|
| // Recreate the service and have it load the tabs.
|
| @@ -396,7 +400,7 @@
|
|
|
| AddThreeNavigations();
|
|
|
| - service_->CreateHistoricalTab(&controller(), -1);
|
| + service_->CreateHistoricalTab(contents(), -1);
|
|
|
| RecreateService();
|
|
|
| @@ -439,7 +443,7 @@
|
|
|
| AddThreeNavigations();
|
|
|
| - service_->CreateHistoricalTab(&controller(), -1);
|
| + service_->CreateHistoricalTab(contents(), -1);
|
|
|
| RecreateService();
|
|
|
| @@ -483,7 +487,7 @@
|
|
|
| AddThreeNavigations();
|
|
|
| - service_->CreateHistoricalTab(&controller(), -1);
|
| + service_->CreateHistoricalTab(contents(), -1);
|
|
|
| RecreateService();
|
|
|
| @@ -512,7 +516,7 @@
|
| AddThreeNavigations();
|
|
|
| // Have the service record the tab.
|
| - service_->CreateHistoricalTab(&controller(), -1);
|
| + service_->CreateHistoricalTab(contents(), -1);
|
|
|
| // Make sure an entry was created.
|
| ASSERT_EQ(1U, service_->entries().size());
|
| @@ -640,7 +644,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(&controller(), -1);
|
| + service_->CreateHistoricalTab(contents(), -1);
|
| }
|
|
|
| EXPECT_EQ(max_entries, service_->entries_.size());
|
|
|