| 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 // entries and make sure that setting a SessionTab from it preserves | 319 // entries and make sure that setting a SessionTab from it preserves |
| 320 // those entries (and clobbers any existing data). | 320 // those entries (and clobbers any existing data). |
| 321 TEST_F(SyncSessionModelAssociatorTest, SetSessionTabFromDelegate) { | 321 TEST_F(SyncSessionModelAssociatorTest, SetSessionTabFromDelegate) { |
| 322 // Create a tab with three valid entries. | 322 // Create a tab with three valid entries. |
| 323 NiceMock<SyncedTabDelegateMock> tab_mock; | 323 NiceMock<SyncedTabDelegateMock> tab_mock; |
| 324 EXPECT_CALL(tab_mock, GetSessionId()).WillRepeatedly(Return(0)); | 324 EXPECT_CALL(tab_mock, GetSessionId()).WillRepeatedly(Return(0)); |
| 325 scoped_ptr<content::NavigationEntry> entry1( | 325 scoped_ptr<content::NavigationEntry> entry1( |
| 326 content::NavigationEntry::Create()); | 326 content::NavigationEntry::Create()); |
| 327 entry1->SetVirtualURL(GURL("http://www.google.com")); | 327 entry1->SetVirtualURL(GURL("http://www.google.com")); |
| 328 entry1->SetTimestamp(kTime1); | 328 entry1->SetTimestamp(kTime1); |
| 329 entry1->SetHttpStatusCode(200); |
| 329 scoped_ptr<content::NavigationEntry> entry2( | 330 scoped_ptr<content::NavigationEntry> entry2( |
| 330 content::NavigationEntry::Create()); | 331 content::NavigationEntry::Create()); |
| 331 entry2->SetVirtualURL(GURL("http://www.noodle.com")); | 332 entry2->SetVirtualURL(GURL("http://www.noodle.com")); |
| 332 entry2->SetTimestamp(kTime2); | 333 entry2->SetTimestamp(kTime2); |
| 334 entry2->SetHttpStatusCode(201); |
| 333 scoped_ptr<content::NavigationEntry> entry3( | 335 scoped_ptr<content::NavigationEntry> entry3( |
| 334 content::NavigationEntry::Create()); | 336 content::NavigationEntry::Create()); |
| 335 entry3->SetVirtualURL(GURL("http://www.doodle.com")); | 337 entry3->SetVirtualURL(GURL("http://www.doodle.com")); |
| 336 entry3->SetTimestamp(kTime3); | 338 entry3->SetTimestamp(kTime3); |
| 339 entry3->SetHttpStatusCode(202); |
| 337 EXPECT_CALL(tab_mock, GetCurrentEntryIndex()).WillRepeatedly(Return(2)); | 340 EXPECT_CALL(tab_mock, GetCurrentEntryIndex()).WillRepeatedly(Return(2)); |
| 338 EXPECT_CALL(tab_mock, GetEntryAtIndex(0)).WillRepeatedly( | 341 EXPECT_CALL(tab_mock, GetEntryAtIndex(0)).WillRepeatedly( |
| 339 Return(entry1.get())); | 342 Return(entry1.get())); |
| 340 EXPECT_CALL(tab_mock, GetEntryAtIndex(1)).WillRepeatedly( | 343 EXPECT_CALL(tab_mock, GetEntryAtIndex(1)).WillRepeatedly( |
| 341 Return(entry2.get())); | 344 Return(entry2.get())); |
| 342 EXPECT_CALL(tab_mock, GetEntryAtIndex(2)).WillRepeatedly( | 345 EXPECT_CALL(tab_mock, GetEntryAtIndex(2)).WillRepeatedly( |
| 343 Return(entry3.get())); | 346 Return(entry3.get())); |
| 344 EXPECT_CALL(tab_mock, GetEntryCount()).WillRepeatedly(Return(3)); | 347 EXPECT_CALL(tab_mock, GetEntryCount()).WillRepeatedly(Return(3)); |
| 345 EXPECT_CALL(tab_mock, GetPendingEntryIndex()).WillRepeatedly(Return(-1)); | 348 EXPECT_CALL(tab_mock, GetPendingEntryIndex()).WillRepeatedly(Return(-1)); |
| 346 EXPECT_CALL(tab_mock, ProfileIsManaged()).WillRepeatedly(Return(false)); | 349 EXPECT_CALL(tab_mock, ProfileIsManaged()).WillRepeatedly(Return(false)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 371 ASSERT_EQ(3u, session_tab.navigations.size()); | 374 ASSERT_EQ(3u, session_tab.navigations.size()); |
| 372 EXPECT_EQ(entry1->GetVirtualURL(), | 375 EXPECT_EQ(entry1->GetVirtualURL(), |
| 373 session_tab.navigations[0].virtual_url()); | 376 session_tab.navigations[0].virtual_url()); |
| 374 EXPECT_EQ(entry2->GetVirtualURL(), | 377 EXPECT_EQ(entry2->GetVirtualURL(), |
| 375 session_tab.navigations[1].virtual_url()); | 378 session_tab.navigations[1].virtual_url()); |
| 376 EXPECT_EQ(entry3->GetVirtualURL(), | 379 EXPECT_EQ(entry3->GetVirtualURL(), |
| 377 session_tab.navigations[2].virtual_url()); | 380 session_tab.navigations[2].virtual_url()); |
| 378 EXPECT_EQ(kTime1, session_tab.navigations[0].timestamp()); | 381 EXPECT_EQ(kTime1, session_tab.navigations[0].timestamp()); |
| 379 EXPECT_EQ(kTime2, session_tab.navigations[1].timestamp()); | 382 EXPECT_EQ(kTime2, session_tab.navigations[1].timestamp()); |
| 380 EXPECT_EQ(kTime3, session_tab.navigations[2].timestamp()); | 383 EXPECT_EQ(kTime3, session_tab.navigations[2].timestamp()); |
| 384 EXPECT_EQ(200, session_tab.navigations[0].http_status_code()); |
| 385 EXPECT_EQ(201, session_tab.navigations[1].http_status_code()); |
| 386 EXPECT_EQ(202, session_tab.navigations[2].http_status_code()); |
| 381 EXPECT_EQ(SerializedNavigationEntry::STATE_INVALID, | 387 EXPECT_EQ(SerializedNavigationEntry::STATE_INVALID, |
| 382 session_tab.navigations[0].blocked_state()); | 388 session_tab.navigations[0].blocked_state()); |
| 383 EXPECT_EQ(SerializedNavigationEntry::STATE_INVALID, | 389 EXPECT_EQ(SerializedNavigationEntry::STATE_INVALID, |
| 384 session_tab.navigations[1].blocked_state()); | 390 session_tab.navigations[1].blocked_state()); |
| 385 EXPECT_EQ(SerializedNavigationEntry::STATE_INVALID, | 391 EXPECT_EQ(SerializedNavigationEntry::STATE_INVALID, |
| 386 session_tab.navigations[2].blocked_state()); | 392 session_tab.navigations[2].blocked_state()); |
| 387 EXPECT_TRUE(session_tab.session_storage_persistent_id.empty()); | 393 EXPECT_TRUE(session_tab.session_storage_persistent_id.empty()); |
| 388 } | 394 } |
| 389 | 395 |
| 390 // Tests that for managed users blocked navigations are recorded and marked as | 396 // Tests that for managed users blocked navigations are recorded and marked as |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 // The new page should be mapped to the old favicon data. | 556 // The new page should be mapped to the old favicon data. |
| 551 EXPECT_TRUE(FaviconEquals(GURL(page_url2), std::string())); | 557 EXPECT_TRUE(FaviconEquals(GURL(page_url2), std::string())); |
| 552 LoadTabFavicon(tab2); | 558 LoadTabFavicon(tab2); |
| 553 EXPECT_TRUE(FaviconEquals(GURL(page_url), favicon)); | 559 EXPECT_TRUE(FaviconEquals(GURL(page_url), favicon)); |
| 554 EXPECT_TRUE(FaviconEquals(GURL(page_url2), favicon)); | 560 EXPECT_TRUE(FaviconEquals(GURL(page_url2), favicon)); |
| 555 } | 561 } |
| 556 | 562 |
| 557 } // namespace | 563 } // namespace |
| 558 | 564 |
| 559 } // namespace browser_sync | 565 } // namespace browser_sync |
| OLD | NEW |