本文整理匯總了Java中com.facebook.internal.SessionTracker.stopTracking方法的典型用法代碼示例。如果您正苦於以下問題:Java SessionTracker.stopTracking方法的具體用法?Java SessionTracker.stopTracking怎麽用?Java SessionTracker.stopTracking使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.facebook.internal.SessionTracker
的用法示例。
在下文中一共展示了SessionTracker.stopTracking方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testDelegateWithActiveSession
import com.facebook.internal.SessionTracker; //導入方法依賴的package包/類
@SmallTest
@MediumTest
@LargeTest
// Tests the SessionDelegate while tracking the active session
public void testDelegateWithActiveSession() throws Exception {
Session.setActiveSession(null);
final SessionStatusCallbackRecorder statusRecorder =
new SessionStatusCallbackRecorder();
final MockTokenCachingStrategy cache = new MockTokenCachingStrategy(null, 0);
final ScriptedSession session =
createScriptedSessionOnBlockerThread(cache);
session.addAuthorizeResult(TOKEN_STR, Collections.<String>emptyList(), AccessTokenSource.TEST_USER);
final SessionTracker tracker = new SessionTracker(getActivity(), statusRecorder);
Session.setActiveSession(session);
session.openForRead(new Session.OpenRequest(getActivity()));
statusRecorder.waitForCall(session, SessionState.OPENING, null);
statusRecorder.waitForCall(session, SessionState.OPENED, null);
assertNotNull("Session should be open", tracker.getOpenSession());
assertEquals("Access Token check", TOKEN_STR, tracker.getOpenSession().getAccessToken());
tracker.getOpenSession().close();
statusRecorder.waitForCall(session, SessionState.CLOSED, null);
stall(STRAY_CALLBACK_WAIT_MILLISECONDS);
tracker.stopTracking();
statusRecorder.close();
}
示例2: testDelegateWithSessionInConstructor
import com.facebook.internal.SessionTracker; //導入方法依賴的package包/類
@SmallTest
@MediumTest
@LargeTest
// Tests the SessionDelegate while tracking a passed in session from the constructor
public void testDelegateWithSessionInConstructor() throws Exception {
final SessionStatusCallbackRecorder statusRecorder =
new SessionStatusCallbackRecorder();
final MockTokenCachingStrategy cache = new MockTokenCachingStrategy(null, 0);
final ScriptedSession session =
createScriptedSessionOnBlockerThread(cache);
session.addAuthorizeResult(TOKEN_STR, Collections.<String>emptyList(), AccessTokenSource.TEST_USER);
SessionTracker tracker = new SessionTracker(getActivity(), statusRecorder, session);
session.openForRead(new Session.OpenRequest(getActivity()));
statusRecorder.waitForCall(session, SessionState.OPENING, null);
statusRecorder.waitForCall(session, SessionState.OPENED, null);
assertNotNull("Session should be open", tracker.getOpenSession());
assertEquals("Access Token check", TOKEN_STR, tracker.getOpenSession().getAccessToken());
tracker.getOpenSession().close();
statusRecorder.waitForCall(session, SessionState.CLOSED, null);
stall(STRAY_CALLBACK_WAIT_MILLISECONDS);
tracker.stopTracking();
statusRecorder.close();
}
示例3: testDelegateWithActiveSessionThenNewSession
import com.facebook.internal.SessionTracker; //導入方法依賴的package包/類
@SmallTest
@MediumTest
@LargeTest
// Tests the SessionDelegate while tracking the active session and then a new session
public void testDelegateWithActiveSessionThenNewSession() throws Exception {
Session.setActiveSession(null);
final SessionStatusCallbackRecorder statusRecorder = new SessionStatusCallbackRecorder();
final MockTokenCachingStrategy cache = new MockTokenCachingStrategy(null, 0);
final ScriptedSession session = createScriptedSessionOnBlockerThread(cache);
session.addAuthorizeResult(TOKEN_STR, Collections.<String>emptyList(), AccessTokenSource.TEST_USER);
SessionTracker tracker = new SessionTracker(getActivity(), statusRecorder);
Session.setActiveSession(session);
session.openForRead(new Session.OpenRequest(getActivity()));
statusRecorder.waitForCall(session, SessionState.OPENING, null);
statusRecorder.waitForCall(session, SessionState.OPENED, null);
assertNotNull("Session should be open", tracker.getOpenSession());
assertEquals("Access Token check", TOKEN_STR, tracker.getOpenSession().getAccessToken());
tracker.getOpenSession().close();
statusRecorder.waitForCall(session, SessionState.CLOSED, null);
final ScriptedSession newSession = createScriptedSessionOnBlockerThread(cache);
newSession.addAuthorizeResult(TOKEN_STR, Collections.<String>emptyList(), AccessTokenSource.TEST_USER);
tracker.setSession(newSession);
assertNull("Session should not be open", tracker.getOpenSession());
newSession.openForRead(new Session.OpenRequest(getActivity()));
statusRecorder.waitForCall(newSession, SessionState.OPENING, null);
statusRecorder.waitForCall(newSession, SessionState.OPENED, null);
assertNotNull("Session should be open", tracker.getOpenSession());
assertEquals("Access Token check", TOKEN_STR, tracker.getOpenSession().getAccessToken());
tracker.getOpenSession().close();
statusRecorder.waitForCall(newSession, SessionState.CLOSED, null);
stall(STRAY_CALLBACK_WAIT_MILLISECONDS);
tracker.stopTracking();
statusRecorder.close();
}
示例4: testDelegateWithSessionThenActiveSession
import com.facebook.internal.SessionTracker; //導入方法依賴的package包/類
@SmallTest
@MediumTest
@LargeTest
// Tests the SessionDelegate while tracking a new session and then an active session
public void testDelegateWithSessionThenActiveSession() throws Exception {
Session.setActiveSession(null);
final SessionStatusCallbackRecorder statusRecorder = new SessionStatusCallbackRecorder();
final MockTokenCachingStrategy cache = new MockTokenCachingStrategy(null, 0);
final ScriptedSession session = createScriptedSessionOnBlockerThread(cache);
session.addAuthorizeResult(TOKEN_STR, Collections.<String>emptyList(), AccessTokenSource.TEST_USER);
final SessionTracker tracker = new SessionTracker(getActivity(), statusRecorder, session);
session.openForRead(new Session.OpenRequest(getActivity()));
statusRecorder.waitForCall(session, SessionState.OPENING, null);
statusRecorder.waitForCall(session, SessionState.OPENED, null);
assertNotNull("Session should be open", tracker.getOpenSession());
assertEquals("Access Token check", TOKEN_STR, tracker.getOpenSession().getAccessToken());
tracker.getOpenSession().close();
statusRecorder.waitForCall(session, SessionState.CLOSED, null);
final ScriptedSession newSession = createScriptedSessionOnBlockerThread(cache);
newSession.addAuthorizeResult(TOKEN_STR, Collections.<String>emptyList(), AccessTokenSource.TEST_USER);
// need to run on the blocker thread so that when we register the
// BroadcastReceivers, the handler gets run on the right thread
runOnBlockerThread(new Runnable() {
public void run() {
tracker.setSession(null);
Session.setActiveSession(newSession);
}
}, true);
assertNull("Session should not be open", tracker.getOpenSession());
newSession.openForRead(new Session.OpenRequest(getActivity()));
statusRecorder.waitForCall(newSession, SessionState.OPENING, null);
statusRecorder.waitForCall(newSession, SessionState.OPENED, null);
assertNotNull("Session should be open", tracker.getOpenSession());
assertEquals("Access Token check", TOKEN_STR, tracker.getOpenSession().getAccessToken());
tracker.getOpenSession().close();
statusRecorder.waitForCall(newSession, SessionState.CLOSED, null);
stall(STRAY_CALLBACK_WAIT_MILLISECONDS);
tracker.stopTracking();
statusRecorder.close();
}