Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: chrome/browser/sessions/session_service_unittest.cc

Issue 685133004: Handling |SessionCommand|s as scoped_ptr's (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/sessions/session_service_test_helper.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 TEST_F(SessionServiceTest, RestoreActivation1) { 906 TEST_F(SessionServiceTest, RestoreActivation1) {
907 SessionID window2_id; 907 SessionID window2_id;
908 SessionID tab1_id; 908 SessionID tab1_id;
909 SessionID tab2_id; 909 SessionID tab2_id;
910 SerializedNavigationEntry nav1; 910 SerializedNavigationEntry nav1;
911 SerializedNavigationEntry nav2; 911 SerializedNavigationEntry nav2;
912 912
913 CreateAndWriteSessionWithTwoWindows( 913 CreateAndWriteSessionWithTwoWindows(
914 window2_id, tab1_id, tab2_id, &nav1, &nav2); 914 window2_id, tab1_id, tab2_id, &nav1, &nav2);
915 915
916 service()->ScheduleCommand(CreateSetActiveWindowCommand(window2_id)); 916 service()->ScheduleCommand(CreateSetActiveWindowCommand(window2_id).Pass());
917 service()->ScheduleCommand(CreateSetActiveWindowCommand(window_id)); 917 service()->ScheduleCommand(CreateSetActiveWindowCommand(window_id).Pass());
918 918
919 ScopedVector<SessionWindow> windows; 919 ScopedVector<SessionWindow> windows;
920 SessionID::id_type active_window_id = 0; 920 SessionID::id_type active_window_id = 0;
921 ReadWindows(&(windows.get()), &active_window_id); 921 ReadWindows(&(windows.get()), &active_window_id);
922 EXPECT_EQ(window_id.id(), active_window_id); 922 EXPECT_EQ(window_id.id(), active_window_id);
923 } 923 }
924 924
925 // It's easier to have two separate tests with setup/teardown than to manualy 925 // It's easier to have two separate tests with setup/teardown than to manualy
926 // reset the state for the different flavors of the test. 926 // reset the state for the different flavors of the test.
927 TEST_F(SessionServiceTest, RestoreActivation2) { 927 TEST_F(SessionServiceTest, RestoreActivation2) {
928 SessionID window2_id; 928 SessionID window2_id;
929 SessionID tab1_id; 929 SessionID tab1_id;
930 SessionID tab2_id; 930 SessionID tab2_id;
931 SerializedNavigationEntry nav1; 931 SerializedNavigationEntry nav1;
932 SerializedNavigationEntry nav2; 932 SerializedNavigationEntry nav2;
933 933
934 CreateAndWriteSessionWithTwoWindows( 934 CreateAndWriteSessionWithTwoWindows(
935 window2_id, tab1_id, tab2_id, &nav1, &nav2); 935 window2_id, tab1_id, tab2_id, &nav1, &nav2);
936 936
937 service()->ScheduleCommand(CreateSetActiveWindowCommand(window2_id)); 937 service()->ScheduleCommand(CreateSetActiveWindowCommand(window2_id).Pass());
938 service()->ScheduleCommand(CreateSetActiveWindowCommand(window_id)); 938 service()->ScheduleCommand(CreateSetActiveWindowCommand(window_id).Pass());
939 service()->ScheduleCommand(CreateSetActiveWindowCommand(window2_id)); 939 service()->ScheduleCommand(CreateSetActiveWindowCommand(window2_id).Pass());
940 940
941 ScopedVector<SessionWindow> windows; 941 ScopedVector<SessionWindow> windows;
942 SessionID::id_type active_window_id = 0; 942 SessionID::id_type active_window_id = 0;
943 ReadWindows(&(windows.get()), &active_window_id); 943 ReadWindows(&(windows.get()), &active_window_id);
944 EXPECT_EQ(window2_id.id(), active_window_id); 944 EXPECT_EQ(window2_id.id(), active_window_id);
945 } 945 }
946 946
947 // Makes sure we don't track blacklisted URLs. 947 // Makes sure we don't track blacklisted URLs.
948 TEST_F(SessionServiceTest, IgnoreBlacklistedUrls) { 948 TEST_F(SessionServiceTest, IgnoreBlacklistedUrls) {
949 SessionID tab_id; 949 SessionID tab_id;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_service_test_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698