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_url_util.h" | 5 #include "ppapi/tests/test_url_util.h" |
6 | 6 |
7 #include "ppapi/c/dev/ppb_url_util_dev.h" | 7 #include "ppapi/c/dev/ppb_url_util_dev.h" |
8 #include "ppapi/cpp/dev/url_util_dev.h" | 8 #include "ppapi/cpp/dev/url_util_dev.h" |
9 #include "ppapi/tests/testing_instance.h" | 9 #include "ppapi/tests/testing_instance.h" |
10 | 10 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 ASSERT_FALSE(util_->IsSameSecurityOrigin("http://google.com/", | 101 ASSERT_FALSE(util_->IsSameSecurityOrigin("http://google.com/", |
102 "http://example.com/")); | 102 "http://example.com/")); |
103 ASSERT_TRUE(util_->IsSameSecurityOrigin("http://google.com/foo", | 103 ASSERT_TRUE(util_->IsSameSecurityOrigin("http://google.com/foo", |
104 "http://google.com/bar")); | 104 "http://google.com/bar")); |
105 PASS(); | 105 PASS(); |
106 } | 106 } |
107 | 107 |
108 std::string TestURLUtil::TestDocumentCanRequest() { | 108 std::string TestURLUtil::TestDocumentCanRequest() { |
109 // This is hard to test, but we can at least verify we can't request | 109 // This is hard to test, but we can at least verify we can't request |
110 // some random domain. | 110 // some random domain. |
111 ASSERT_FALSE(util_->DocumentCanRequest(*instance_, "http://evil.com/")); | 111 ASSERT_FALSE(util_->DocumentCanRequest(instance_, "http://evil.com/")); |
112 PASS(); | 112 PASS(); |
113 } | 113 } |
114 | 114 |
115 std::string TestURLUtil::TestDocumentCanAccessDocument() { | 115 std::string TestURLUtil::TestDocumentCanAccessDocument() { |
116 // This is hard to test, but we can at least verify we can access ourselves. | 116 // This is hard to test, but we can at least verify we can access ourselves. |
117 ASSERT_TRUE(util_->DocumentCanAccessDocument(*instance_, *instance_)); | 117 ASSERT_TRUE(util_->DocumentCanAccessDocument(instance_, instance_)); |
118 PASS(); | 118 PASS(); |
119 } | 119 } |
120 | 120 |
121 std::string TestURLUtil::TestGetDocumentURL() { | 121 std::string TestURLUtil::TestGetDocumentURL() { |
122 pp::Var url = util_->GetDocumentURL(*instance_); | 122 pp::Var url = util_->GetDocumentURL(instance_); |
123 ASSERT_TRUE(url.is_string()); | 123 ASSERT_TRUE(url.is_string()); |
124 pp::VarPrivate window = instance_->GetWindowObject(); | 124 pp::VarPrivate window = instance_->GetWindowObject(); |
125 pp::Var href = window.GetProperty("location").GetProperty("href"); | 125 pp::Var href = window.GetProperty("location").GetProperty("href"); |
126 ASSERT_TRUE(href.is_string()); | 126 ASSERT_TRUE(href.is_string()); |
127 // In the test framework, they should be the same. | 127 // In the test framework, they should be the same. |
128 ASSERT_EQ(url.AsString(), href.AsString()); | 128 ASSERT_EQ(url.AsString(), href.AsString()); |
129 PASS(); | 129 PASS(); |
130 } | 130 } |
131 | 131 |
132 std::string TestURLUtil::TestGetPluginInstanceURL() { | 132 std::string TestURLUtil::TestGetPluginInstanceURL() { |
133 pp::Var url = util_->GetPluginInstanceURL(*instance_); | 133 pp::Var url = util_->GetPluginInstanceURL(instance_); |
134 ASSERT_TRUE(url.is_string()); | 134 ASSERT_TRUE(url.is_string()); |
135 // see test_case.html | 135 // see test_case.html |
136 ASSERT_EQ(url.AsString(), "http://a.b.c/test"); | 136 ASSERT_EQ(url.AsString(), "http://a.b.c/test"); |
137 PASS(); | 137 PASS(); |
138 } | 138 } |
OLD | NEW |