| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 std::ostringstream output; | 23 std::ostringstream output; |
| 24 output << "Failure in " << file << "(" << line << "): " << cmd; | 24 output << "Failure in " << file << "(" << line << "): " << cmd; |
| 25 return output.str(); | 25 return output.str(); |
| 26 } | 26 } |
| 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(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 pp::deprecated::ScriptableObject* TestCase::CreateTestObject() { | 37 pp::deprecated::ScriptableObject* TestCase::CreateTestObject() { |
| 38 return NULL; | 38 return NULL; |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool TestCase::InitTestingInterface() { | 41 bool TestCase::InitTestingInterface() { |
| 42 if (!GetTestingInterface()) { | 42 if (!GetTestingInterface()) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 55 pp::Var window = instance_->GetWindowObject(); | 55 pp::Var window = instance_->GetWindowObject(); |
| 56 pp::Var location = window.GetProperty("location"); | 56 pp::Var location = window.GetProperty("location"); |
| 57 pp::Var protocol = location.GetProperty("protocol"); | 57 pp::Var protocol = location.GetProperty("protocol"); |
| 58 if (!protocol.is_string() || protocol.AsString() != "http:") { | 58 if (!protocol.is_string() || protocol.AsString() != "http:") { |
| 59 instance_->AppendError("This test needs to be run over HTTP."); | 59 instance_->AppendError("This test needs to be run over HTTP."); |
| 60 return false; | 60 return false; |
| 61 } | 61 } |
| 62 | 62 |
| 63 return true; | 63 return true; |
| 64 } | 64 } |
| OLD | NEW |