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/macros.h" | 5 #include "base/macros.h" |
6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
7 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h" | 7 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h" |
8 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 8 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
9 #include "chrome/browser/sync/test/integration/sessions_helper.h" | 9 #include "chrome/browser/sync/test/integration/sessions_helper.h" |
10 #include "chrome/browser/sync/test/integration/sync_test.h" | 10 #include "chrome/browser/sync/test/integration/sync_test.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 73 } |
74 WaitForTabsToLoad(profile, urls); | 74 WaitForTabsToLoad(profile, urls); |
75 } | 75 } |
76 | 76 |
77 void SessionsSyncPerfTest::RemoveTabs(int profile) { | 77 void SessionsSyncPerfTest::RemoveTabs(int profile) { |
78 GetBrowser(profile)->tab_strip_model()->CloseAllTabs(); | 78 GetBrowser(profile)->tab_strip_model()->CloseAllTabs(); |
79 } | 79 } |
80 | 80 |
81 int SessionsSyncPerfTest::GetTabCount(int profile) { | 81 int SessionsSyncPerfTest::GetTabCount(int profile) { |
82 int tab_count = 0; | 82 int tab_count = 0; |
83 const sync_driver::SyncedSession* local_session; | 83 const sync_sessions::SyncedSession* local_session; |
84 SyncedSessionVector sessions; | 84 SyncedSessionVector sessions; |
85 | 85 |
86 if (!GetLocalSession(profile, &local_session)) { | 86 if (!GetLocalSession(profile, &local_session)) { |
87 DVLOG(1) << "GetLocalSession returned false"; | 87 DVLOG(1) << "GetLocalSession returned false"; |
88 return -1; | 88 return -1; |
89 } | 89 } |
90 | 90 |
91 if (!GetSessionData(profile, &sessions)) { | 91 if (!GetSessionData(profile, &sessions)) { |
92 // Foreign session data may be empty. In this case we only count tabs in | 92 // Foreign session data may be empty. In this case we only count tabs in |
93 // the local session. | 93 // the local session. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 ASSERT_EQ(kNumTabs, GetTabCount(1)); | 131 ASSERT_EQ(kNumTabs, GetTabCount(1)); |
132 SyncTimingHelper::PrintResult("tabs", "update_tabs", dt); | 132 SyncTimingHelper::PrintResult("tabs", "update_tabs", dt); |
133 | 133 |
134 RemoveTabs(0); | 134 RemoveTabs(0); |
135 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 135 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
136 // New tab page remains open on profile 0 after closing all tabs. | 136 // New tab page remains open on profile 0 after closing all tabs. |
137 ASSERT_EQ(1, GetTabCount(0)); | 137 ASSERT_EQ(1, GetTabCount(0)); |
138 ASSERT_EQ(0, GetTabCount(1)); | 138 ASSERT_EQ(0, GetTabCount(1)); |
139 SyncTimingHelper::PrintResult("tabs", "delete_tabs", dt); | 139 SyncTimingHelper::PrintResult("tabs", "delete_tabs", dt); |
140 } | 140 } |
OLD | NEW |