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

Side by Side Diff: tests/test_instance.cc

Issue 2901005: Add support for running all tests with a single click from test_case.html.... (Closed) Base URL: http://ppapi.googlecode.com/svn/trunk/
Patch Set: '' Created 10 years, 5 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 | « tests/test_case.html ('k') | tests/test_page.css » ('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) 2010 The Chromium Authors. All rights reserved. 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 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 "ppapi/tests/test_instance.h" 5 #include "ppapi/tests/test_instance.h"
6 6
7 #include <algorithm>
7 #include <string.h> 8 #include <string.h>
8 9
9 #include "ppapi/cpp/module.h" 10 #include "ppapi/cpp/module.h"
10 #include "ppapi/cpp/var.h" 11 #include "ppapi/cpp/var.h"
11 #include "ppapi/tests/test_case.h" 12 #include "ppapi/tests/test_case.h"
12 13
13 TestCaseFactory* TestCaseFactory::head_ = NULL; 14 TestCaseFactory* TestCaseFactory::head_ = NULL;
14 15
15 // Returns a new heap-allocated test case for the given test, or NULL on 16 // Returns a new heap-allocated test case for the given test, or NULL on
16 // failure. 17 // failure.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 while (iter != NULL) { 101 while (iter != NULL) {
101 if (strcmp(name, iter->name_) == 0) 102 if (strcmp(name, iter->name_) == 0)
102 return iter->method_(this); 103 return iter->method_(this);
103 iter = iter->next_; 104 iter = iter->next_;
104 } 105 }
105 return NULL; 106 return NULL;
106 } 107 }
107 108
108 void TestInstance::LogAvailableTests() { 109 void TestInstance::LogAvailableTests() {
109 // Print out a listing of all tests. 110 // Print out a listing of all tests.
111 std::vector<std::string> test_cases;
112 TestCaseFactory* iter = TestCaseFactory::head_;
113 while (iter != NULL) {
114 test_cases.push_back(iter->name_);
115 iter = iter->next_;
116 }
117 std::sort(test_cases.begin(), test_cases.end());
118
110 std::string html; 119 std::string html;
111 html.append("Available test cases: <dl>"); 120 html.append("Available test cases: <dl>");
112 TestCaseFactory* iter = TestCaseFactory::head_; 121 for (size_t i = 0; i < test_cases.size(); ++i) {
113 while (iter != NULL) {
114 html.append("<dd><a href='?"); 122 html.append("<dd><a href='?");
115 html.append(iter->name_); 123 html.append(test_cases[i]);
116 html.append("'>"); 124 html.append("'>");
117 html.append(iter->name_); 125 html.append(test_cases[i]);
118 html.append("</a></dd>"); 126 html.append("</a></dd>");
119 iter = iter->next_;
120 } 127 }
121 html.append("</dl>"); 128 html.append("</dl>");
129 html.append("<button onclick='RunAll()'>Run All Tests</button>");
122 LogHTML(html); 130 LogHTML(html);
123 } 131 }
124 132
125 void TestInstance::LogError(const std::string& text) { 133 void TestInstance::LogError(const std::string& text) {
126 std::string html; 134 std::string html;
127 html.append("<span class=\"fail\">FAIL</span>: <span class=\"err_msg\">"); 135 html.append("<span class=\"fail\">FAIL</span>: <span class=\"err_msg\">");
128 html.append(text); 136 html.append(text);
129 html.append("</span>"); 137 html.append("</span>");
130 LogHTML(html); 138 LogHTML(html);
131 } 139 }
(...skipping 24 matching lines...) Expand all
156 } 164 }
157 }; 165 };
158 166
159 namespace pp { 167 namespace pp {
160 168
161 Module* CreateModule() { 169 Module* CreateModule() {
162 return new ::Module(); 170 return new ::Module();
163 } 171 }
164 172
165 } // namespace pp 173 } // namespace pp
OLDNEW
« no previous file with comments | « tests/test_case.html ('k') | tests/test_page.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698