OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/stringprintf.h" | 5 #include "base/stringprintf.h" |
6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
7 #include "chrome/browser/sync/profile_sync_service_harness.h" | 7 #include "chrome/browser/sync/profile_sync_service_harness.h" |
8 #include "chrome/test/live_sync/performance/sync_timing_helper.h" | 8 #include "chrome/test/live_sync/performance/sync_timing_helper.h" |
9 #include "chrome/test/live_sync/live_sync_test.h" | 9 #include "chrome/test/live_sync/live_sync_test.h" |
10 #include "chrome/test/live_sync/sessions_helper.h" | 10 #include "chrome/test/live_sync/sessions_helper.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 WaitForTabsToLoad(profile, urls); | 66 WaitForTabsToLoad(profile, urls); |
67 } | 67 } |
68 | 68 |
69 void SessionsSyncPerfTest::RemoveTabs(int profile) { | 69 void SessionsSyncPerfTest::RemoveTabs(int profile) { |
70 GetBrowser(profile)->CloseAllTabs(); | 70 GetBrowser(profile)->CloseAllTabs(); |
71 } | 71 } |
72 | 72 |
73 int SessionsSyncPerfTest::GetTabCount(int profile) { | 73 int SessionsSyncPerfTest::GetTabCount(int profile) { |
74 int tab_count = 0; | 74 int tab_count = 0; |
75 const browser_sync::SyncedSession* local_session; | 75 const SyncedSession* local_session; |
76 SyncedSessionVector sessions; | 76 SyncedSessionVector sessions; |
77 | 77 |
78 if (!GetLocalSession(profile, &local_session)) { | 78 if (!GetLocalSession(profile, &local_session)) { |
79 VLOG(1) << "GetLocalSession returned false"; | 79 VLOG(1) << "GetLocalSession returned false"; |
80 return -1; | 80 return -1; |
81 } | 81 } |
82 | 82 |
83 if (!GetSessionData(profile, &sessions)) { | 83 if (!GetSessionData(profile, &sessions)) { |
84 // Foreign session data may be empty. In this case we only count tabs in | 84 // Foreign session data may be empty. In this case we only count tabs in |
85 // the local session. | 85 // the local session. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 ASSERT_EQ(kNumTabs, GetTabCount(1)); | 122 ASSERT_EQ(kNumTabs, GetTabCount(1)); |
123 SyncTimingHelper::PrintResult("tabs", "update_tabs", dt); | 123 SyncTimingHelper::PrintResult("tabs", "update_tabs", dt); |
124 | 124 |
125 RemoveTabs(0); | 125 RemoveTabs(0); |
126 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 126 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
127 // New tab page remains open on profile 0 after closing all tabs. | 127 // New tab page remains open on profile 0 after closing all tabs. |
128 ASSERT_EQ(1, GetTabCount(0)); | 128 ASSERT_EQ(1, GetTabCount(0)); |
129 ASSERT_EQ(0, GetTabCount(1)); | 129 ASSERT_EQ(0, GetTabCount(1)); |
130 SyncTimingHelper::PrintResult("tabs", "delete_tabs", dt); | 130 SyncTimingHelper::PrintResult("tabs", "delete_tabs", dt); |
131 } | 131 } |
OLD | NEW |