~osomon/oxide/non-ime-initiated-text-edit

« back to all changes in this revision

Viewing changes to qt/tests/qmltests/core/tst_Incognito_cookies.qml

  • Committer: Olivier Tilloy
  • Date: 2015-05-18 14:31:37 UTC
  • mfrom: (1022.1.58 oxide)
  • Revision ID: olivier.tilloy@canonical.com-20150518143137-omciv1buwk0t5r6o
Merge the latest changes from trunk and resolve a couple of conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.0
 
2
import QtTest 1.0
 
3
import com.canonical.Oxide.Testing 1.0
 
4
 
 
5
Column {
 
6
 
 
7
  TestWebContext {
 
8
    id: context
 
9
  }
 
10
 
 
11
  TestWebView {
 
12
    id: webView1
 
13
    width: 200
 
14
    height: 100
 
15
    context: context
 
16
  }
 
17
 
 
18
  TestWebView {
 
19
    id: webView2
 
20
    width: 200
 
21
    height: 100
 
22
    context: context
 
23
  }
 
24
 
 
25
  TestWebView {
 
26
    id: webView3
 
27
    width: 200
 
28
    height: 200
 
29
    context: context
 
30
    incognito: true
 
31
  }
 
32
 
 
33
  TestWebView {
 
34
    id: webView4
 
35
    width: 200
 
36
    height: 200
 
37
    context: context
 
38
    incognito: true
 
39
  }
 
40
 
 
41
  TestCase {
 
42
    id: test
 
43
    name: "Incognito_cookies"
 
44
    when: windowShown
 
45
 
 
46
    function init() {
 
47
      webView1.clearLoadEventCounters();
 
48
      webView2.clearLoadEventCounters();
 
49
      webView3.clearLoadEventCounters();
 
50
      webView4.clearLoadEventCounters();
 
51
      context.deleteAllCookies();
 
52
    }
 
53
 
 
54
    // Verify that a cookie set in a normal webview is not accessible in an
 
55
    // incognito webview
 
56
    function test_Incognito_cookies1() {
 
57
      webView1.url = "http://testsuite/empty.html";
 
58
      verify(webView1.waitForLoadSucceeded());
 
59
 
 
60
      webView1.getTestApi().evaluateCode("document.cookie = \"foo=bar\"", false);
 
61
 
 
62
      webView2.url = "http://testsuite/empty.html";
 
63
      verify(webView2.waitForLoadSucceeded());
 
64
 
 
65
      compare(webView2.getTestApi().evaluateCode("document.cookie", false),
 
66
              "foo=bar");
 
67
 
 
68
      webView3.url = "http://testsuite/empty.html";
 
69
      verify(webView3.waitForLoadSucceeded());
 
70
 
 
71
      compare(webView3.getTestApi().evaluateCode("document.cookie", false), "");
 
72
    }
 
73
 
 
74
    // Verify that a cookie set in an incognito webview is not accessible in
 
75
    // a normal webview
 
76
    function test_Incognito_cookies2() {
 
77
      webView3.url = "http://testsuite/empty.html";
 
78
      verify(webView3.waitForLoadSucceeded());
 
79
 
 
80
      webView3.getTestApi().evaluateCode("document.cookie = \"foo2=bar\"", false);
 
81
 
 
82
      webView4.url = "http://testsuite/empty.html";
 
83
      verify(webView4.waitForLoadSucceeded());
 
84
 
 
85
      compare(webView4.getTestApi().evaluateCode("document.cookie", false),
 
86
              "foo2=bar");
 
87
 
 
88
      webView1.url = "http://testsuite/empty.html";
 
89
      verify(webView1.waitForLoadSucceeded());
 
90
 
 
91
      compare(webView1.getTestApi().evaluateCode("document.cookie", false), "");
 
92
    }
 
93
  }
 
94
}