| OLD | NEW |
| 1 // Copyright (c) 2010 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" |
| 11 | 11 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 pp::Var TestCase::GetTestObject() { | 28 pp::Var TestCase::GetTestObject() { |
| 29 if (test_object_.is_undefined()) { | 29 if (test_object_.is_undefined()) { |
| 30 pp::deprecated::ScriptableObject* so = CreateTestObject(); | 30 pp::deprecated::ScriptableObject* so = CreateTestObject(); |
| 31 if (so) | 31 if (so) |
| 32 test_object_ = pp::Var(instance_, so); // Takes ownership. | 32 test_object_ = pp::Var(instance_, so); // Takes ownership. |
| 33 } | 33 } |
| 34 return test_object_; | 34 return test_object_; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void TestCase::HandleMessage(const pp::Var& message_data) {} |
| 38 |
| 37 pp::deprecated::ScriptableObject* TestCase::CreateTestObject() { | 39 pp::deprecated::ScriptableObject* TestCase::CreateTestObject() { |
| 38 return NULL; | 40 return NULL; |
| 39 } | 41 } |
| 40 | 42 |
| 41 bool TestCase::InitTestingInterface() { | 43 bool TestCase::InitTestingInterface() { |
| 42 if (!GetTestingInterface()) { | 44 if (!GetTestingInterface()) { |
| 43 // Give a more helpful error message for the testing interface being gone | 45 // Give a more helpful error message for the testing interface being gone |
| 44 // since that needs special enabling in Chrome. | 46 // since that needs special enabling in Chrome. |
| 45 instance_->AppendError("This test needs the testing interface, which is " | 47 instance_->AppendError("This test needs the testing interface, which is " |
| 46 "not currently available. In Chrome, use " | 48 "not currently available. In Chrome, use " |
| 47 "--enable-pepper-testing when launching."); | 49 "--enable-pepper-testing when launching."); |
| 48 return false; | 50 return false; |
| 49 } | 51 } |
| 50 | 52 |
| 51 return true; | 53 return true; |
| 52 } | 54 } |
| 53 | 55 |
| 54 bool TestCase::EnsureRunningOverHTTP() { | 56 bool TestCase::EnsureRunningOverHTTP() { |
| 55 pp::Var window = instance_->GetWindowObject(); | 57 pp::Var window = instance_->GetWindowObject(); |
| 56 pp::Var location = window.GetProperty("location"); | 58 pp::Var location = window.GetProperty("location"); |
| 57 pp::Var protocol = location.GetProperty("protocol"); | 59 pp::Var protocol = location.GetProperty("protocol"); |
| 58 if (!protocol.is_string() || protocol.AsString() != "http:") { | 60 if (!protocol.is_string() || protocol.AsString() != "http:") { |
| 59 instance_->AppendError("This test needs to be run over HTTP."); | 61 instance_->AppendError("This test needs to be run over HTTP."); |
| 60 return false; | 62 return false; |
| 61 } | 63 } |
| 62 | 64 |
| 63 return true; | 65 return true; |
| 64 } | 66 } |
| OLD | NEW |