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

Side by Side Diff: ppapi/tests/test_case.cc

Issue 10081020: PPAPI: Make blocking completion callbacks work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated TestURLLoader to test blocking callbacks. Created 8 years, 8 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
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 #include "ppapi/tests/test_case.h" 5 #include "ppapi/tests/test_case.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "ppapi/tests/test_utils.h" 9 #include "ppapi/tests/test_utils.h"
10 #include "ppapi/tests/testing_instance.h" 10 #include "ppapi/tests/testing_instance.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 101
102 return true; 102 return true;
103 } 103 }
104 104
105 bool TestCase::MatchesFilter(const std::string& test_name, 105 bool TestCase::MatchesFilter(const std::string& test_name,
106 const std::string& filter) { 106 const std::string& filter) {
107 return filter.empty() || (test_name == filter); 107 return filter.empty() || (test_name == filter);
108 } 108 }
109 109
110 std::string TestCase::CheckResourcesAndVars() { 110 std::string TestCase::CheckResourcesAndVars(std::string errors) {
111 std::string errors; 111 if (!errors.empty())
112 return errors;
113
112 if (testing_interface_) { 114 if (testing_interface_) {
113 // TODO(dmichael): Fix tests that leak resources and enable the following: 115 // TODO(dmichael): Fix tests that leak resources and enable the following:
114 /* 116 /*
115 uint32_t leaked_resources = 117 uint32_t leaked_resources =
116 testing_interface_->GetLiveObjectsForInstance(instance_->pp_instance()); 118 testing_interface_->GetLiveObjectsForInstance(instance_->pp_instance());
117 if (leaked_resources) { 119 if (leaked_resources) {
118 std::ostringstream output; 120 std::ostringstream output;
119 output << "FAILED: Test leaked " << leaked_resources << " resources.\n"; 121 output << "FAILED: Test leaked " << leaked_resources << " resources.\n";
120 errors += output.str(); 122 errors += output.str();
121 } 123 }
(...skipping 14 matching lines...) Expand all
136 } 138 }
137 for (int i = 0; i < std::min(found_vars, kVarsToPrint); ++i) { 139 for (int i = 0; i < std::min(found_vars, kVarsToPrint); ++i) {
138 pp::Var leaked_var(pp::PASS_REF, vars[i]); 140 pp::Var leaked_var(pp::PASS_REF, vars[i]);
139 if (ignored_leaked_vars_.count(leaked_var.pp_var().value.as_id) == 0) 141 if (ignored_leaked_vars_.count(leaked_var.pp_var().value.as_id) == 0)
140 errors += leaked_var.DebugString() + "<p>"; 142 errors += leaked_var.DebugString() + "<p>";
141 } 143 }
142 } 144 }
143 return errors; 145 return errors;
144 } 146 }
145 147
148 // static
149 void TestCase::QuitMainMessageLoop(PP_Instance instance) {
150 PP_Instance* heap_instance = new PP_Instance(instance);
151 pp::CompletionCallback callback(&DoQuitMainMessageLoop, heap_instance);
152 pp::Module::Get()->core()->CallOnMainThread(0, callback);
153 }
146 154
155 // static
156 void TestCase::DoQuitMainMessageLoop(void* pp_instance, int32_t result) {
157 PP_Instance* instance = static_cast<PP_Instance*>(pp_instance);
158 GetTestingInterface()->QuitMessageLoop(*instance);
159 delete instance;
160 }
161
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698