OLD | NEW |
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 Loading... |
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 pp::Var TestCase::GetTestObject() { | 38 #if !(defined __native_client__) |
| 39 pp::VarPrivate TestCase::GetTestObject() { |
39 if (test_object_.is_undefined()) { | 40 if (test_object_.is_undefined()) { |
40 pp::deprecated::ScriptableObject* so = CreateTestObject(); | 41 pp::deprecated::ScriptableObject* so = CreateTestObject(); |
41 if (so) | 42 if (so) |
42 test_object_ = pp::Var(instance_, so); // Takes ownership. | 43 test_object_ = pp::VarPrivate(instance_, so); // Takes ownership. |
43 } | 44 } |
44 return test_object_; | 45 return test_object_; |
45 } | 46 } |
| 47 #endif |
46 | 48 |
47 void TestCase::HandleMessage(const pp::Var& message_data) {} | 49 void TestCase::HandleMessage(const pp::Var& message_data) {} |
48 | 50 |
| 51 #if !(defined __native_client__) |
49 pp::deprecated::ScriptableObject* TestCase::CreateTestObject() { | 52 pp::deprecated::ScriptableObject* TestCase::CreateTestObject() { |
50 return NULL; | 53 return NULL; |
51 } | 54 } |
| 55 #endif |
52 | 56 |
53 bool TestCase::InitTestingInterface() { | 57 bool TestCase::InitTestingInterface() { |
54 testing_interface_ = GetTestingInterface(); | 58 testing_interface_ = GetTestingInterface(); |
55 if (!testing_interface_) { | 59 if (!testing_interface_) { |
56 // Give a more helpful error message for the testing interface being gone | 60 // Give a more helpful error message for the testing interface being gone |
57 // since that needs special enabling in Chrome. | 61 // since that needs special enabling in Chrome. |
58 instance_->AppendError("This test needs the testing interface, which is " | 62 instance_->AppendError("This test needs the testing interface, which is " |
59 "not currently available. In Chrome, use " | 63 "not currently available. In Chrome, use " |
60 "--enable-pepper-testing when launching."); | 64 "--enable-pepper-testing when launching."); |
61 return false; | 65 return false; |
62 } | 66 } |
63 | 67 |
64 return true; | 68 return true; |
65 } | 69 } |
66 | 70 |
67 bool TestCase::EnsureRunningOverHTTP() { | 71 bool TestCase::EnsureRunningOverHTTP() { |
68 pp::Var window = instance_->GetWindowObject(); | 72 if (instance_->protocol() != "http:") { |
69 pp::Var location = window.GetProperty("location"); | |
70 pp::Var protocol = location.GetProperty("protocol"); | |
71 if (!protocol.is_string() || protocol.AsString() != "http:") { | |
72 instance_->AppendError("This test needs to be run over HTTP."); | 73 instance_->AppendError("This test needs to be run over HTTP."); |
73 return false; | 74 return false; |
74 } | 75 } |
75 | 76 |
76 return true; | 77 return true; |
77 } | 78 } |
OLD | NEW |