| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 helper_.AssertTabEquals(window_id, tab_id, 0, 0, 1, *tab); | 715 helper_.AssertTabEquals(window_id, tab_id, 0, 0, 1, *tab); |
| 716 helper_.AssertNavigationEquals(nav1, tab->navigations[0]); | 716 helper_.AssertNavigationEquals(nav1, tab->navigations[0]); |
| 717 EXPECT_TRUE(user_agent_override == tab->user_agent_override); | 717 EXPECT_TRUE(user_agent_override == tab->user_agent_override); |
| 718 } | 718 } |
| 719 | 719 |
| 720 // Test that the notification for SESSION_SERVICE_SAVED is working properly. | 720 // Test that the notification for SESSION_SERVICE_SAVED is working properly. |
| 721 TEST_F(SessionServiceTest, SavedSessionNotification) { | 721 TEST_F(SessionServiceTest, SavedSessionNotification) { |
| 722 content::NotificationRegistrar registrar_; | 722 content::NotificationRegistrar registrar_; |
| 723 registrar_.Add(this, chrome::NOTIFICATION_SESSION_SERVICE_SAVED, | 723 registrar_.Add(this, chrome::NOTIFICATION_SESSION_SERVICE_SAVED, |
| 724 content::NotificationService::AllSources()); | 724 content::NotificationService::AllSources()); |
| 725 service()->Save(); | 725 service()->GetBaseSessionServiceForTest()->SaveNow(); |
| 726 EXPECT_EQ(sync_save_count_, 1); | 726 EXPECT_EQ(sync_save_count_, 1); |
| 727 } | 727 } |
| 728 | 728 |
| 729 // Makes sure a tab closed by a user gesture is not restored. | 729 // Makes sure a tab closed by a user gesture is not restored. |
| 730 TEST_F(SessionServiceTest, CloseTabUserGesture) { | 730 TEST_F(SessionServiceTest, CloseTabUserGesture) { |
| 731 SessionID tab_id; | 731 SessionID tab_id; |
| 732 ASSERT_NE(window_id.id(), tab_id.id()); | 732 ASSERT_NE(window_id.id(), tab_id.id()); |
| 733 | 733 |
| 734 SerializedNavigationEntry nav1 = | 734 SerializedNavigationEntry nav1 = |
| 735 SerializedNavigationEntryTestHelper::CreateNavigation( | 735 SerializedNavigationEntryTestHelper::CreateNavigation( |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 &cancelable_task_tracker); | 1017 &cancelable_task_tracker); |
| 1018 helper_.RunTaskOnBackendThread( | 1018 helper_.RunTaskOnBackendThread( |
| 1019 FROM_HERE, | 1019 FROM_HERE, |
| 1020 base::Bind(&PostBackToThread, | 1020 base::Bind(&PostBackToThread, |
| 1021 base::Unretained(base::MessageLoop::current()), | 1021 base::Unretained(base::MessageLoop::current()), |
| 1022 base::Unretained(&run_loop))); | 1022 base::Unretained(&run_loop))); |
| 1023 delete helper_.ReleaseService(); | 1023 delete helper_.ReleaseService(); |
| 1024 event.Signal(); | 1024 event.Signal(); |
| 1025 run_loop.Run(); | 1025 run_loop.Run(); |
| 1026 } | 1026 } |
| OLD | NEW |