| 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.h" | 9 #include "base/message_loop.h" |
| 10 #include "chrome/browser/sessions/session_types.h" | 10 #include "chrome/browser/sessions/session_types.h" |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 // entries and make sure that setting a SessionTab from it preserves | 553 // entries and make sure that setting a SessionTab from it preserves |
| 554 // those entries (and clobbers any existing data). | 554 // those entries (and clobbers any existing data). |
| 555 TEST_F(SyncSessionModelAssociatorTest, SetSessionTabFromDelegate) { | 555 TEST_F(SyncSessionModelAssociatorTest, SetSessionTabFromDelegate) { |
| 556 // Create a tab with three valid entries. | 556 // Create a tab with three valid entries. |
| 557 NiceMock<SyncedTabDelegateMock> tab_mock; | 557 NiceMock<SyncedTabDelegateMock> tab_mock; |
| 558 EXPECT_CALL(tab_mock, GetSessionId()).WillRepeatedly(Return(0)); | 558 EXPECT_CALL(tab_mock, GetSessionId()).WillRepeatedly(Return(0)); |
| 559 scoped_ptr<content::NavigationEntry> entry1( | 559 scoped_ptr<content::NavigationEntry> entry1( |
| 560 content::NavigationEntry::Create()); | 560 content::NavigationEntry::Create()); |
| 561 entry1->SetVirtualURL(GURL("http://www.google.com")); | 561 entry1->SetVirtualURL(GURL("http://www.google.com")); |
| 562 entry1->SetTimestamp(kTime1); | 562 entry1->SetTimestamp(kTime1); |
| 563 entry1->SetHttpStatusCode(200); |
| 563 scoped_ptr<content::NavigationEntry> entry2( | 564 scoped_ptr<content::NavigationEntry> entry2( |
| 564 content::NavigationEntry::Create()); | 565 content::NavigationEntry::Create()); |
| 565 entry2->SetVirtualURL(GURL("http://www.noodle.com")); | 566 entry2->SetVirtualURL(GURL("http://www.noodle.com")); |
| 566 entry2->SetTimestamp(kTime2); | 567 entry2->SetTimestamp(kTime2); |
| 568 entry2->SetHttpStatusCode(201); |
| 567 scoped_ptr<content::NavigationEntry> entry3( | 569 scoped_ptr<content::NavigationEntry> entry3( |
| 568 content::NavigationEntry::Create()); | 570 content::NavigationEntry::Create()); |
| 569 entry3->SetVirtualURL(GURL("http://www.doodle.com")); | 571 entry3->SetVirtualURL(GURL("http://www.doodle.com")); |
| 570 entry3->SetTimestamp(kTime3); | 572 entry3->SetTimestamp(kTime3); |
| 573 entry3->SetHttpStatusCode(202); |
| 571 EXPECT_CALL(tab_mock, GetCurrentEntryIndex()).WillRepeatedly(Return(2)); | 574 EXPECT_CALL(tab_mock, GetCurrentEntryIndex()).WillRepeatedly(Return(2)); |
| 572 EXPECT_CALL(tab_mock, GetEntryAtIndex(0)).WillRepeatedly( | 575 EXPECT_CALL(tab_mock, GetEntryAtIndex(0)).WillRepeatedly( |
| 573 Return(entry1.get())); | 576 Return(entry1.get())); |
| 574 EXPECT_CALL(tab_mock, GetEntryAtIndex(1)).WillRepeatedly( | 577 EXPECT_CALL(tab_mock, GetEntryAtIndex(1)).WillRepeatedly( |
| 575 Return(entry2.get())); | 578 Return(entry2.get())); |
| 576 EXPECT_CALL(tab_mock, GetEntryAtIndex(2)).WillRepeatedly( | 579 EXPECT_CALL(tab_mock, GetEntryAtIndex(2)).WillRepeatedly( |
| 577 Return(entry3.get())); | 580 Return(entry3.get())); |
| 578 EXPECT_CALL(tab_mock, GetEntryCount()).WillRepeatedly(Return(3)); | 581 EXPECT_CALL(tab_mock, GetEntryCount()).WillRepeatedly(Return(3)); |
| 579 EXPECT_CALL(tab_mock, GetPendingEntryIndex()).WillRepeatedly(Return(-1)); | 582 EXPECT_CALL(tab_mock, GetPendingEntryIndex()).WillRepeatedly(Return(-1)); |
| 580 | 583 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 607 EXPECT_EQ(entry2->GetVirtualURL(), | 610 EXPECT_EQ(entry2->GetVirtualURL(), |
| 608 session_tab.navigations[1].virtual_url()); | 611 session_tab.navigations[1].virtual_url()); |
| 609 EXPECT_EQ(entry3->GetVirtualURL(), | 612 EXPECT_EQ(entry3->GetVirtualURL(), |
| 610 session_tab.navigations[2].virtual_url()); | 613 session_tab.navigations[2].virtual_url()); |
| 611 EXPECT_EQ(kTime1, | 614 EXPECT_EQ(kTime1, |
| 612 SessionTypesTestHelper::GetTimestamp(session_tab.navigations[0])); | 615 SessionTypesTestHelper::GetTimestamp(session_tab.navigations[0])); |
| 613 EXPECT_EQ(kTime2, | 616 EXPECT_EQ(kTime2, |
| 614 SessionTypesTestHelper::GetTimestamp(session_tab.navigations[1])); | 617 SessionTypesTestHelper::GetTimestamp(session_tab.navigations[1])); |
| 615 EXPECT_EQ(kTime3, | 618 EXPECT_EQ(kTime3, |
| 616 SessionTypesTestHelper::GetTimestamp(session_tab.navigations[2])); | 619 SessionTypesTestHelper::GetTimestamp(session_tab.navigations[2])); |
| 620 EXPECT_EQ(200, |
| 621 SessionTypesTestHelper::GetHttpStatusCode( |
| 622 session_tab.navigations[0])); |
| 623 EXPECT_EQ(201, |
| 624 SessionTypesTestHelper::GetHttpStatusCode( |
| 625 session_tab.navigations[1])); |
| 626 EXPECT_EQ(202, |
| 627 SessionTypesTestHelper::GetHttpStatusCode( |
| 628 session_tab.navigations[2])); |
| 617 EXPECT_TRUE(session_tab.session_storage_persistent_id.empty()); | 629 EXPECT_TRUE(session_tab.session_storage_persistent_id.empty()); |
| 618 } | 630 } |
| 619 | 631 |
| 620 } // namespace | 632 } // namespace |
| 621 | 633 |
| 622 } // namespace browser_sync | 634 } // namespace browser_sync |
| OLD | NEW |