| OLD | NEW |
| 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 /** | 5 /** |
| 6 * @fileoverview Generator script for creating gtest-style JavaScript | 6 * @fileoverview Generator script for creating gtest-style JavaScript |
| 7 * tests for WebUI and unit tests. Generates C++ gtest wrappers | 7 * tests for WebUI and unit tests. Generates C++ gtest wrappers |
| 8 * which will invoke the appropriate JavaScript for each test. | 8 * which will invoke the appropriate JavaScript for each test. |
| 9 * @author scr@chromium.org (Sheridan Rawlins) | 9 * @author scr@chromium.org (Sheridan Rawlins) |
| 10 * @see WebUI testing: http://goo.gl/ZWFXF | 10 * @see WebUI testing: http://goo.gl/ZWFXF |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // | 84 // |
| 85 // Currently supports: | 85 // Currently supports: |
| 86 // 'unit' - unit_tests harness, js2unit rule, V8UnitTest superclass. | 86 // 'unit' - unit_tests harness, js2unit rule, V8UnitTest superclass. |
| 87 // 'webui' - browser_tests harness, js2webui rule, WebUIBrowserTest superclass. | 87 // 'webui' - browser_tests harness, js2webui rule, WebUIBrowserTest superclass. |
| 88 if (testType === 'unit') { | 88 if (testType === 'unit') { |
| 89 print('#include "chrome/test/base/v8_unit_test.h"'); | 89 print('#include "chrome/test/base/v8_unit_test.h"'); |
| 90 testing.Test.prototype.typedefCppFixture = 'V8UnitTest'; | 90 testing.Test.prototype.typedefCppFixture = 'V8UnitTest'; |
| 91 testF = 'TEST_F'; | 91 testF = 'TEST_F'; |
| 92 addSetPreloadInfo = false; | 92 addSetPreloadInfo = false; |
| 93 } else { | 93 } else { |
| 94 print('#include "chrome/test/base/web_ui_browsertest.h"'); | 94 print('#include "chrome/browser/ui/webui/web_ui_browsertest.h"'); |
| 95 testing.Test.prototype.typedefCppFixture = 'WebUIBrowserTest'; | 95 testing.Test.prototype.typedefCppFixture = 'WebUIBrowserTest'; |
| 96 testF = 'IN_PROC_BROWSER_TEST_F'; | 96 testF = 'IN_PROC_BROWSER_TEST_F'; |
| 97 addSetPreloadInfo = true; | 97 addSetPreloadInfo = true; |
| 98 } | 98 } |
| 99 print('#include "googleurl/src/gurl.h"'); | 99 print('#include "googleurl/src/gurl.h"'); |
| 100 print('#include "testing/gtest/include/gtest/gtest.h"'); | 100 print('#include "testing/gtest/include/gtest/gtest.h"'); |
| 101 print(); | 101 print(); |
| 102 | 102 |
| 103 /** | 103 /** |
| 104 * Convert the |includeFile| to paths appropriate for immediate | 104 * Convert the |includeFile| to paths appropriate for immediate |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 '"' + testFunction + '"));'); | 189 '"' + testFunction + '"));'); |
| 190 if (testGenPostamble) | 190 if (testGenPostamble) |
| 191 testGenPostamble(testFixture, testFunction); | 191 testGenPostamble(testFixture, testFunction); |
| 192 print('}'); | 192 print('}'); |
| 193 print(); | 193 print(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 // Now that generation functions are defined, load in |jsFile|. | 196 // Now that generation functions are defined, load in |jsFile|. |
| 197 var js = read(jsFile); | 197 var js = read(jsFile); |
| 198 eval(js); | 198 eval(js); |
| OLD | NEW |