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