OLD | NEW |
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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 ASSERT_FALSE(error.IsSet()); | 1280 ASSERT_FALSE(error.IsSet()); |
1281 | 1281 |
1282 // To simulate WebContents swap during prerendering, create new WebContents | 1282 // To simulate WebContents swap during prerendering, create new WebContents |
1283 // and swap with old WebContents. | 1283 // and swap with old WebContents. |
1284 content::WebContents* old_web_contents = | 1284 content::WebContents* old_web_contents = |
1285 browser()->tab_strip_model()->GetActiveWebContents(); | 1285 browser()->tab_strip_model()->GetActiveWebContents(); |
1286 | 1286 |
1287 // Create new WebContents, with the required tab helpers. | 1287 // Create new WebContents, with the required tab helpers. |
1288 WebContents* new_web_contents = WebContents::CreateWithSessionStorage( | 1288 WebContents* new_web_contents = WebContents::CreateWithSessionStorage( |
1289 WebContents::CreateParams(profile()), | 1289 WebContents::CreateParams(profile()), |
1290 old_web_contents->GetController().GetSessionStorageNamespaceMap()); | 1290 old_web_contents->GetController().GetSessionStorageNamespaceMap(), |
| 1291 NULL); |
1291 SessionTabHelper::CreateForWebContents(new_web_contents); | 1292 SessionTabHelper::CreateForWebContents(new_web_contents); |
1292 TabContentsSyncedTabDelegate::CreateForWebContents(new_web_contents); | 1293 TabContentsSyncedTabDelegate::CreateForWebContents(new_web_contents); |
1293 new_web_contents->GetController() | 1294 new_web_contents->GetController() |
1294 .CopyStateFrom(old_web_contents->GetController()); | 1295 .CopyStateFrom(old_web_contents->GetController()); |
1295 | 1296 |
1296 // Swap the WebContents. | 1297 // Swap the WebContents. |
1297 int index = | 1298 int index = |
1298 browser()->tab_strip_model()->GetIndexOfWebContents(old_web_contents); | 1299 browser()->tab_strip_model()->GetIndexOfWebContents(old_web_contents); |
1299 browser()->tab_strip_model()->ReplaceWebContentsAt(index, new_web_contents); | 1300 browser()->tab_strip_model()->ReplaceWebContentsAt(index, new_web_contents); |
1300 | 1301 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 // Freeing the last sync node should drop the free nodes to | 1360 // Freeing the last sync node should drop the free nodes to |
1360 // kFreeNodesLowWatermark. | 1361 // kFreeNodesLowWatermark. |
1361 model_associator_->tab_pool_.FreeTabNode(last_sync_id); | 1362 model_associator_->tab_pool_.FreeTabNode(last_sync_id); |
1362 EXPECT_FALSE(model_associator_->tab_pool_.Empty()); | 1363 EXPECT_FALSE(model_associator_->tab_pool_.Empty()); |
1363 EXPECT_TRUE(model_associator_->tab_pool_.Full()); | 1364 EXPECT_TRUE(model_associator_->tab_pool_.Full()); |
1364 EXPECT_EQ(TabNodePool::kFreeNodesLowWatermark, | 1365 EXPECT_EQ(TabNodePool::kFreeNodesLowWatermark, |
1365 model_associator_->tab_pool_.Capacity()); | 1366 model_associator_->tab_pool_.Capacity()); |
1366 } | 1367 } |
1367 | 1368 |
1368 } // namespace browser_sync | 1369 } // namespace browser_sync |
OLD | NEW |