| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include <stddef.h> | 5 #include <stddef.h> |
| 6 #import <Foundation/Foundation.h> | 6 #import <Foundation/Foundation.h> |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #import "ios/web/public/test/web_test_with_web_state.h" | 10 #import "ios/web/public/test/web_test_with_web_state.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 "temp.toJSON = 42;" | 122 "temp.toJSON = 42;" |
| 123 "__gCrWeb.stringify(temp)", | 123 "__gCrWeb.stringify(temp)", |
| 124 @"[1,2]"}, | 124 @"[1,2]"}, |
| 125 // Stringify an undefined object. | 125 // Stringify an undefined object. |
| 126 {@"__gCrWeb.stringify(undefined)", @"undefined"}, | 126 {@"__gCrWeb.stringify(undefined)", @"undefined"}, |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 for (size_t i = 0; i < arraysize(test_data); i++) { | 129 for (size_t i = 0; i < arraysize(test_data); i++) { |
| 130 TestScriptAndExpectedValue& data = test_data[i]; | 130 TestScriptAndExpectedValue& data = test_data[i]; |
| 131 // Load a sample HTML page. As a side-effect, loading HTML via | 131 // Load a sample HTML page. As a side-effect, loading HTML via |
| 132 // |webController_| will also inject core.js. | 132 // |webController_| will also inject web_bundle.js. |
| 133 LoadHtml(@"<p>"); | 133 LoadHtml(@"<p>"); |
| 134 id result = ExecuteJavaScript(data.test_script); | 134 id result = ExecuteJavaScript(data.test_script); |
| 135 EXPECT_NSEQ(data.expected_value, result) | 135 EXPECT_NSEQ(data.expected_value, result) |
| 136 << " in test " << i << ": " | 136 << " in test " << i << ": " |
| 137 << base::SysNSStringToUTF8(data.test_script); | 137 << base::SysNSStringToUTF8(data.test_script); |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace web | 141 } // namespace web |
| OLD | NEW |