Upstream version 7.35.144.0
[platform/framework/web/crosswalk.git] / src / chrome / test / functional / chromeos_security.py
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import os
7
8 import pyauto_functional
9 import pyauto
10
11
12 class ChromeosSecurity(pyauto.PyUITest):
13   """Security tests for chrome on ChromeOS.
14
15   Requires ChromeOS to be logged in.
16   """
17
18   def ExtraChromeFlags(self):
19     """Override default list of extra flags typically used with automation.
20
21     See the default flags used with automation in pyauto.py.
22     Chrome flags for this test should be as close to reality as possible.
23     """
24     return [
25       '--homepage=about:blank',
26     ]
27
28   def testCannotViewLocalFiles(self):
29     """Verify that local files cannot be accessed from the browser."""
30     urls_and_titles = {
31        'file:///': 'Index of /',
32        'file:///etc/': 'Index of /etc/',
33        self.GetFileURLForDataPath('title2.html'): 'Title Of Awesomeness',
34     }
35     for url, title in urls_and_titles.iteritems():
36       self.NavigateToURL(url)
37       self.assertNotEqual(title, self.GetActiveTabTitle(),
38           msg='Could access local file %s.' % url)
39
40
41 if __name__ == '__main__':
42   pyauto_functional.Main()