| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/json/json_value_serializer.h" | 7 #include "base/json/json_value_serializer.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 << error_message; | 118 << error_message; |
| 119 } | 119 } |
| 120 | 120 |
| 121 // Crashes on Vista, see http://crbug.com/43855 | 121 // Crashes on Vista, see http://crbug.com/43855 |
| 122 #if defined(OS_WIN) | 122 #if defined(OS_WIN) |
| 123 #define MAYBE_WithV8 DISABLED_WithV8 | 123 #define MAYBE_WithV8 DISABLED_WithV8 |
| 124 #else | 124 #else |
| 125 #define MAYBE_WithV8 WithV8 | 125 #define MAYBE_WithV8 WithV8 |
| 126 #endif | 126 #endif |
| 127 | 127 |
| 128 // Use V8 to load the string resource version of extension_api.json . | 128 // Use V8 to load the string resource version of extension_api.json. |
| 129 // This test mimics the method extension_api.json is loaded in | 129 // This test mimics the method extension_api.json is loaded in |
| 130 // chrome/renderer/resources/extension_process_bindings.js . | 130 // chrome/renderer/resources/extensions/schema_generated_bindings.js. |
| 131 TEST_F(ExtensionApiJsonValidityTest, MAYBE_WithV8) { | 131 TEST_F(ExtensionApiJsonValidityTest, MAYBE_WithV8) { |
| 132 std::string ext_api_string = | 132 std::string ext_api_string = |
| 133 ResourceBundle::GetSharedInstance().GetRawDataResource( | 133 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 134 IDR_EXTENSION_API_JSON).as_string(); | 134 IDR_EXTENSION_API_JSON).as_string(); |
| 135 | 135 |
| 136 // Create a global variable holding the text of extension_api.json . | 136 // Create a global variable holding the text of extension_api.json . |
| 137 SetGlobalStringVar("ext_api_json_text", ext_api_string); | 137 SetGlobalStringVar("ext_api_json_text", ext_api_string); |
| 138 | 138 |
| 139 // Parse the text of extension_api.json . If there is a parse error, | 139 // Parse the text of extension_api.json . If there is a parse error, |
| 140 // an exception will be printed that includes a line number. | 140 // an exception will be printed that includes a line number. |
| 141 std::string test_js = "var extension_api = JSON.parse(ext_api_json_text);"; | 141 std::string test_js = "var extension_api = JSON.parse(ext_api_json_text);"; |
| 142 ExecuteScriptInContext(test_js, "ParseExtensionApiJson"); | 142 ExecuteScriptInContext(test_js, "ParseExtensionApiJson"); |
| 143 } | 143 } |
| OLD | NEW |