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

Side by Side Diff: native_client_sdk/src/libraries/gtest_ppapi/gtest_instance.cc

Issue 10854137: [NaCl SDK] gtest_ppapi library. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove hacks Created 8 years, 4 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 "c_salt/test/gtest_instance.h" 5 #include "gtest_ppapi/gtest_instance.h"
6 #include "c_salt/test/gtest_runner.h" 6 #include "gtest_ppapi/gtest_runner.h"
7 #include "ppapi/cpp/var.h" 7 #include "ppapi/cpp/var.h"
8 8
9 namespace c_salt {
10
11 GTestInstance::GTestInstance(PP_Instance instance) 9 GTestInstance::GTestInstance(PP_Instance instance)
12 : pp::Instance(instance) { 10 : pp::Instance(instance) {
13 } 11 }
14 12
15 GTestInstance::~GTestInstance() { 13 GTestInstance::~GTestInstance() {
16 } 14 }
17 15
18 bool GTestInstance::Init(uint32_t /* argc */, const char* /* argn */[], 16 bool GTestInstance::Init(uint32_t /* argc */, const char* /* argn */[],
19 const char* /* argv */[]) { 17 const char* /* argv */[]) {
20 // Create a GTestRunner thread/singleton. 18 // Create a GTestRunner thread/singleton.
21 int local_argc = 0; 19 int local_argc = 0;
22 c_salt::GTestRunner::CreateGTestRunnerThread(this, local_argc, NULL); 20 GTestRunner::CreateGTestRunnerThread(this, local_argc, NULL);
23 return true; 21 return true;
24 } 22 }
25 23
26 void GTestInstance::HandleMessage(const pp::Var& var_message) { 24 void GTestInstance::HandleMessage(const pp::Var& var_message) {
27 if (!var_message.is_string()) { 25 if (!var_message.is_string()) {
28 PostMessage("Invalid message"); 26 PostMessage("Invalid message");
29 return; 27 return;
30 } 28 }
31 29
32 std::string message = var_message.AsString(); 30 std::string message = var_message.AsString();
33 if (message == "RunGTest") { 31 if (message == "RunGTest") {
34 // This is our signal to start running the tests. Results from the tests 32 // This is our signal to start running the tests. Results from the tests
35 // are posted through GTestEventListener. 33 // are posted through GTestEventListener.
36 c_salt::GTestRunner::gtest_runner()->RunAllTests(); 34 GTestRunner::gtest_runner()->RunAllTests();
37 } else { 35 } else {
38 std::string return_var; 36 std::string return_var;
39 return_var = "Unknown message "; 37 return_var = "Unknown message ";
40 return_var += message; 38 return_var += message;
41 PostMessage(return_var); 39 PostMessage(return_var);
42 } 40 }
43 } 41 }
44
45 } // namespace c_salt
46
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698