1# Copyright 2013 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5from telemetry.internal.backends import form_based_credentials_backend
6
7
8class FacebookCredentialsBackend(
9    form_based_credentials_backend.FormBasedCredentialsBackend):
10
11  @property
12  def logged_in_javascript(self):
13    """Evaluates to true iff already logged in."""
14    return ('document.getElementById("fbNotificationsList")!== null || '
15            'document.getElementById("m_home_notice")!== null')
16
17  @property
18  def credentials_type(self):
19    return 'facebook'
20
21  @property
22  def url(self):
23    return 'http://www.facebook.com/'
24
25  @property
26  def login_form_id(self):
27    return 'login_form'
28
29  @property
30  def login_input_id(self):
31    return 'email'
32
33  @property
34  def password_input_id(self):
35    return 'pass'
36
37class FacebookCredentialsBackend2(FacebookCredentialsBackend):
38  """ Facebook credential backend for https client. """
39
40  @property
41  def credentials_type(self):
42    return 'facebook2'
43
44  @property
45  def url(self):
46    return 'https://www.facebook.com/'
47