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/ui/browser_commands.h" | 7 #include "chrome/browser/ui/browser_commands.h" |
| 8 #include "chrome/browser/ui/browser_tabstrip.h" |
8 #include "chrome/browser/sync/profile_sync_service_harness.h" | 9 #include "chrome/browser/sync/profile_sync_service_harness.h" |
9 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h" | 10 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h" |
10 #include "chrome/browser/sync/test/integration/sessions_helper.h" | 11 #include "chrome/browser/sync/test/integration/sessions_helper.h" |
11 #include "chrome/browser/sync/test/integration/sync_test.h" | 12 #include "chrome/browser/sync/test/integration/sync_test.h" |
12 | 13 |
13 using content::OpenURLParams; | 14 using content::OpenURLParams; |
14 using sessions_helper::GetLocalSession; | 15 using sessions_helper::GetLocalSession; |
15 using sessions_helper::GetSessionData; | 16 using sessions_helper::GetSessionData; |
16 using sessions_helper::OpenMultipleTabs; | 17 using sessions_helper::OpenMultipleTabs; |
17 using sessions_helper::SyncedSessionVector; | 18 using sessions_helper::SyncedSessionVector; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 content::Referrer(GURL("http://localhost"), | 69 content::Referrer(GURL("http://localhost"), |
69 WebKit::WebReferrerPolicyDefault), | 70 WebKit::WebReferrerPolicyDefault), |
70 CURRENT_TAB, | 71 CURRENT_TAB, |
71 content::PageTransitionFromInt(0), false)); | 72 content::PageTransitionFromInt(0), false)); |
72 urls.push_back(url); | 73 urls.push_back(url); |
73 } | 74 } |
74 WaitForTabsToLoad(profile, urls); | 75 WaitForTabsToLoad(profile, urls); |
75 } | 76 } |
76 | 77 |
77 void SessionsSyncPerfTest::RemoveTabs(int profile) { | 78 void SessionsSyncPerfTest::RemoveTabs(int profile) { |
78 GetBrowser(profile)->CloseAllTabs(); | 79 chrome::CloseAllTabs(GetBrowser(profile)); |
79 } | 80 } |
80 | 81 |
81 int SessionsSyncPerfTest::GetTabCount(int profile) { | 82 int SessionsSyncPerfTest::GetTabCount(int profile) { |
82 int tab_count = 0; | 83 int tab_count = 0; |
83 const browser_sync::SyncedSession* local_session; | 84 const browser_sync::SyncedSession* local_session; |
84 SyncedSessionVector sessions; | 85 SyncedSessionVector sessions; |
85 | 86 |
86 if (!GetLocalSession(profile, &local_session)) { | 87 if (!GetLocalSession(profile, &local_session)) { |
87 DVLOG(1) << "GetLocalSession returned false"; | 88 DVLOG(1) << "GetLocalSession returned false"; |
88 return -1; | 89 return -1; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 ASSERT_EQ(kNumTabs, GetTabCount(1)); | 132 ASSERT_EQ(kNumTabs, GetTabCount(1)); |
132 SyncTimingHelper::PrintResult("tabs", "update_tabs", dt); | 133 SyncTimingHelper::PrintResult("tabs", "update_tabs", dt); |
133 | 134 |
134 RemoveTabs(0); | 135 RemoveTabs(0); |
135 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 136 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
136 // New tab page remains open on profile 0 after closing all tabs. | 137 // New tab page remains open on profile 0 after closing all tabs. |
137 ASSERT_EQ(1, GetTabCount(0)); | 138 ASSERT_EQ(1, GetTabCount(0)); |
138 ASSERT_EQ(0, GetTabCount(1)); | 139 ASSERT_EQ(0, GetTabCount(1)); |
139 SyncTimingHelper::PrintResult("tabs", "delete_tabs", dt); | 140 SyncTimingHelper::PrintResult("tabs", "delete_tabs", dt); |
140 } | 141 } |
OLD | NEW |