OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 package org.chromium.chrome.browser.sync; | 5 package org.chromium.chrome.browser.sync; |
6 | 6 |
7 import android.accounts.Account; | 7 import android.accounts.Account; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.test.suitebuilder.annotation.LargeTest; | 9 import android.test.suitebuilder.annotation.LargeTest; |
10 import android.util.Log; | 10 import android.util.Log; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 final String expectedSyncSummary = | 141 final String expectedSyncSummary = |
142 aboutInfoGetter.getAboutInfo().get(SyncTestUtil.SYNC_SUMMARY_STA
TUS); | 142 aboutInfoGetter.getAboutInfo().get(SyncTestUtil.SYNC_SUMMARY_STA
TUS); |
143 | 143 |
144 Criteria checker = new Criteria() { | 144 Criteria checker = new Criteria() { |
145 @Override | 145 @Override |
146 public boolean isSatisfied() { | 146 public boolean isSatisfied() { |
147 final ContentViewCore contentViewCore = getContentViewCore(getAc
tivity()); | 147 final ContentViewCore contentViewCore = getContentViewCore(getAc
tivity()); |
148 String innerHtml = ""; | 148 String innerHtml = ""; |
149 try { | 149 try { |
150 innerHtml = JavaScriptUtils.executeJavaScriptAndWaitForResul
t( | 150 innerHtml = JavaScriptUtils.executeJavaScriptAndWaitForResul
t( |
151 contentViewCore, "document.documentElement.innerHTML
"); | 151 contentViewCore.getWebContents(), "document.document
Element.innerHTML"); |
152 } catch (InterruptedException e) { | 152 } catch (InterruptedException e) { |
153 Log.w(TAG, "Interrupted while polling about:sync page for sy
nc status.", e); | 153 Log.w(TAG, "Interrupted while polling about:sync page for sy
nc status.", e); |
154 } catch (TimeoutException e) { | 154 } catch (TimeoutException e) { |
155 Log.w(TAG, "Interrupted while polling about:sync page for sy
nc status.", e); | 155 Log.w(TAG, "Interrupted while polling about:sync page for sy
nc status.", e); |
156 } | 156 } |
157 return innerHtml.contains(expectedSyncSummary); | 157 return innerHtml.contains(expectedSyncSummary); |
158 } | 158 } |
159 | 159 |
160 }; | 160 }; |
161 boolean hadExpectedStatus = CriteriaHelper.pollForCriteria( | 161 boolean hadExpectedStatus = CriteriaHelper.pollForCriteria( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 SyncTestUtil.verifySyncIsSignedIn(mContext, defaultTestAccount); | 209 SyncTestUtil.verifySyncIsSignedIn(mContext, defaultTestAccount); |
210 assertTrue("Sync everything should be enabled", | 210 assertTrue("Sync everything should be enabled", |
211 SyncTestUtil.isSyncEverythingEnabled(mContext)); | 211 SyncTestUtil.isSyncEverythingEnabled(mContext)); |
212 } | 212 } |
213 | 213 |
214 private static ContentViewCore getContentViewCore(ChromeShellActivity activi
ty) { | 214 private static ContentViewCore getContentViewCore(ChromeShellActivity activi
ty) { |
215 return activity.getActiveContentViewCore(); | 215 return activity.getActiveContentViewCore(); |
216 } | 216 } |
217 } | 217 } |
OLD | NEW |