~webapps/webapps-applications/precise

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function Test(browser) {
    this._init(browser);
}

Test.prototype = {
    _init: function (browser) {
        this._state = 0;
        browser.open('https://accounts.google.com/ServiceLogin?service=reader&passive=1209600&continue=http://www.google.com/reader/&followup=http://www.google.com/reader/');

        this._browser = browser;
    },

    onLoad: function () {
        var login = this._browser.getLogin();
        var password = this._browser.getPassword();
        if (!login) {
            this._browser.skipTest();
        }
        if (this._state === 0) {
            this._browser.injectScript("(function(){var name = document.getElementById('Email'); var password = document.getElementById('Passwd'); name.value = '"
                                       + login + "'; password.value = '" + password
                                       + "'; password.form.submit();})();");
        } else if (this._state >= 2) {
            this._browser.finish();
        }
        this._state++;
    },

    validateCallLog: function (log) {
        if (log[1].func !== "Unity.init") {
            return false;
        }
        if (log[1].args[0].name !== "\"Google Reader\"") {
            return false;
        }
        if (log[2].func !== "Unity.MessagingIndicator.showIndicator") {
            return false;
        }
        if (log[3].func !== "Unity.addAction") {
            return false;
        }
        if (log.length < 10) {
            return false;
        }
        return true;
    },

    scriptName: 'google-reader.user.js.in',
    dependencies: ['utils.js', 'google-common.js']
};