Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(715)

Side by Side Diff: chrome/test/data/extensions/api_test/executescript/callback/test.js

Issue 129153002: Make V8ValueConverterImpl serialize objects with internal field counts to an (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update test expectation Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/renderer/v8_value_converter_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var relativePath = 5 var relativePath =
6 '/extensions/api_test/executescript/callback/test.html'; 6 '/extensions/api_test/executescript/callback/test.html';
7 var testUrl = 'http://b.com:PORT' + relativePath; 7 var testUrl = 'http://b.com:PORT' + relativePath;
8 8
9 chrome.test.getConfig(function(config) { 9 chrome.test.getConfig(function(config) {
10 testUrl = testUrl.replace(/PORT/, config.testServer.port); 10 testUrl = testUrl.replace(/PORT/, config.testServer.port);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 function executeCallbackObjShouldSucceed() { 80 function executeCallbackObjShouldSucceed() {
81 var scriptDetails = {code: 'var obj = {"id": "foo", "bar": 9}; obj'}; 81 var scriptDetails = {code: 'var obj = {"id": "foo", "bar": 9}; obj'};
82 chrome.tabs.executeScript(tabId, scriptDetails, function(scriptVal) { 82 chrome.tabs.executeScript(tabId, scriptDetails, function(scriptVal) {
83 chrome.tabs.get(tabId, chrome.test.callbackPass(function(tab) { 83 chrome.tabs.get(tabId, chrome.test.callbackPass(function(tab) {
84 chrome.test.assertEq({"id": "foo", "bar": 9}, scriptVal[0]); 84 chrome.test.assertEq({"id": "foo", "bar": 9}, scriptVal[0]);
85 })); 85 }));
86 }); 86 });
87 }, 87 },
88 88
89 // DOM objects (nodes, properties, etc) should not get converted. We 89 // DOM objects (nodes, properties, etc) should be converted to empty
90 // could try to convert them the best they can but it's undefined what 90 // objects. We could try to convert them the best they can but it's
91 // that means. 91 // undefined what that means. Ideally it'd just throw an exception but
92 // the backwards compatible ship sailed long ago.
92 function executeCallbackDOMObjShouldSucceedAndReturnNull() { 93 function executeCallbackDOMObjShouldSucceedAndReturnNull() {
93 [ 'document', 94 [ 'document',
94 'document.getElementById("testDiv")', 95 'document.getElementById("testDiv")',
95 'new XMLHttpRequest()', 96 'new XMLHttpRequest()',
96 'document.location', 97 'document.location',
97 'navigator', 98 'navigator',
98 ].forEach(function(expr) { 99 ].forEach(function(expr) {
99 chrome.tabs.executeScript(tabId, 100 chrome.tabs.executeScript(tabId,
100 {code: 'var obj = ' + expr + '; obj'}, 101 {code: 'var obj = ' + expr + '; obj'},
101 chrome.test.callbackPass(function(result) { 102 chrome.test.callbackPass(function(result) {
102 chrome.test.assertEq([null], result, 'Failed for ' + expr); 103 chrome.test.assertEq([{}], result, 'Failed for ' + expr);
103 })); 104 }));
104 }); 105 });
105 }, 106 },
106 107
107 // All non-integer properties are droped. 108 // All non-integer properties are droped.
108 function executeCallbackArrayWithNonNumericFieldsShouldSucceed() { 109 function executeCallbackArrayWithNonNumericFieldsShouldSucceed() {
109 var scriptDetails = {} 110 var scriptDetails = {}
110 scriptDetails.code = 'var arr = [1, 2]; arr.foo = "bar"; arr;'; 111 scriptDetails.code = 'var arr = [1, 2]; arr.foo = "bar"; arr;';
111 chrome.tabs.executeScript(tabId, scriptDetails, function(scriptVal) { 112 chrome.tabs.executeScript(tabId, scriptDetails, function(scriptVal) {
112 chrome.tabs.get(tabId, chrome.test.callbackPass(function(tab) { 113 chrome.tabs.get(tabId, chrome.test.callbackPass(function(tab) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // is not null 153 // is not null
153 chrome.test.assertFalse(null == scriptVal[0]); 154 chrome.test.assertFalse(null == scriptVal[0]);
154 })); 155 }));
155 }); 156 });
156 }, 157 },
157 ]); 158 ]);
158 }); 159 });
159 chrome.tabs.create({ url: testUrl }); 160 chrome.tabs.create({ url: testUrl });
160 161
161 }); 162 });
OLDNEW
« no previous file with comments | « no previous file | content/renderer/v8_value_converter_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698