- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / api_test / extension_module / cognito_file / test.js
1 // Copyright (c) 2010 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
5 // extension api test
6 // browser_tests.exe --gtest_filter=ExtensionModuleApiTest.CognitoFile
7
8 chrome.test.runTests([
9   function testUpdateUrlData() {
10     // Data string must not be too long.
11     try {
12       var data =
13           '01234567890123456789012345678901234567890123456789' +
14           '01234567890123456789012345678901234567890123456789' +  // 100
15           '01234567890123456789012345678901234567890123456789' +
16           '01234567890123456789012345678901234567890123456789' +  // 200
17           '01234567890123456789012345678901234567890123456789' +
18           '01234567890123456789012345678901234567890123456789' +  // 300
19           '01234567890123456789012345678901234567890123456789' +
20           '01234567890123456789012345678901234567890123456789' +  // 400
21           '01234567890123456789012345678901234567890123456789' +
22           '01234567890123456789012345678901234567890123456789' +  // 500
23           '01234567890123456789012345678901234567890123456789' +
24           '01234567890123456789012345678901234567890123456789' +  // 600
25           '01234567890123456789012345678901234567890123456789' +
26           '01234567890123456789012345678901234567890123456789' +  // 700
27           '01234567890123456789012345678901234567890123456789' +
28           '01234567890123456789012345678901234567890123456789' +  // 800
29           '01234567890123456789012345678901234567890123456789' +
30           '01234567890123456789012345678901234567890123456789' +  // 900
31           '01234567890123456789012345678901234567890123456789' +
32           '01234567890123456789012345678901234567890123456789' +  // 1000
33           '01234567890123456789012345678901234567890123456789';
34       chrome.extension.setUpdateUrlData(data);
35       // Should not reach this line since the above call throws.
36       chrome.test.fail();
37     } catch(ex) {
38     }
39
40     chrome.extension.setUpdateUrlData('a=1&b=2&foo');
41     chrome.test.succeed();
42   },
43   function testPermissions() {
44     chrome.extension.isAllowedIncognitoAccess(
45         chrome.test.callbackPass(function(hasAccess) {
46           chrome.test.assertFalse(hasAccess);
47         }));
48     chrome.extension.isAllowedFileSchemeAccess(
49         chrome.test.callbackPass(function(hasAccess) {
50           chrome.test.assertTrue(hasAccess);
51         }));
52   }
53 ]);