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

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

Issue 7329024: Revert 91859 - Porting ppapi_tests framework to postMessage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 | « ppapi/tests/test_case.h ('k') | ppapi/tests/test_case.html » ('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) 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 "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 17 matching lines...) Expand all
28 // GYP_DEFINES='branding=Chrome buildtype=Official target_arch=x64' 28 // GYP_DEFINES='branding=Chrome buildtype=Official target_arch=x64'
29 // gclient runhooks 29 // gclient runhooks
30 // make -k -j4 BUILDTYPE=Release ppapi_tests 30 // make -k -j4 BUILDTYPE=Release ppapi_tests
31 std::string s; 31 std::string s;
32 32
33 std::ostringstream output; 33 std::ostringstream output;
34 output << "Failure in " << file << "(" << line << "): " << cmd; 34 output << "Failure in " << file << "(" << line << "): " << cmd;
35 return output.str(); 35 return output.str();
36 } 36 }
37 37
38 #if !(defined __native_client__) 38 pp::Var TestCase::GetTestObject() {
39 pp::VarPrivate TestCase::GetTestObject() {
40 if (test_object_.is_undefined()) { 39 if (test_object_.is_undefined()) {
41 pp::deprecated::ScriptableObject* so = CreateTestObject(); 40 pp::deprecated::ScriptableObject* so = CreateTestObject();
42 if (so) 41 if (so)
43 test_object_ = pp::VarPrivate(instance_, so); // Takes ownership. 42 test_object_ = pp::Var(instance_, so); // Takes ownership.
44 } 43 }
45 return test_object_; 44 return test_object_;
46 } 45 }
47 #endif
48 46
49 void TestCase::HandleMessage(const pp::Var& message_data) {} 47 void TestCase::HandleMessage(const pp::Var& message_data) {}
50 48
51 #if !(defined __native_client__)
52 pp::deprecated::ScriptableObject* TestCase::CreateTestObject() { 49 pp::deprecated::ScriptableObject* TestCase::CreateTestObject() {
53 return NULL; 50 return NULL;
54 } 51 }
55 #endif
56 52
57 bool TestCase::InitTestingInterface() { 53 bool TestCase::InitTestingInterface() {
58 testing_interface_ = GetTestingInterface(); 54 testing_interface_ = GetTestingInterface();
59 if (!testing_interface_) { 55 if (!testing_interface_) {
60 // Give a more helpful error message for the testing interface being gone 56 // Give a more helpful error message for the testing interface being gone
61 // since that needs special enabling in Chrome. 57 // since that needs special enabling in Chrome.
62 instance_->AppendError("This test needs the testing interface, which is " 58 instance_->AppendError("This test needs the testing interface, which is "
63 "not currently available. In Chrome, use " 59 "not currently available. In Chrome, use "
64 "--enable-pepper-testing when launching."); 60 "--enable-pepper-testing when launching.");
65 return false; 61 return false;
66 } 62 }
67 63
68 return true; 64 return true;
69 } 65 }
70 66
71 bool TestCase::EnsureRunningOverHTTP() { 67 bool TestCase::EnsureRunningOverHTTP() {
72 if (instance_->protocol() != "http:") { 68 pp::Var window = instance_->GetWindowObject();
69 pp::Var location = window.GetProperty("location");
70 pp::Var protocol = location.GetProperty("protocol");
71 if (!protocol.is_string() || protocol.AsString() != "http:") {
73 instance_->AppendError("This test needs to be run over HTTP."); 72 instance_->AppendError("This test needs to be run over HTTP.");
74 return false; 73 return false;
75 } 74 }
76 75
77 return true; 76 return true;
78 } 77 }
OLDNEW
« no previous file with comments | « ppapi/tests/test_case.h ('k') | ppapi/tests/test_case.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698