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

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

Issue 4182010: Use PASS() everywhere in ppapi/tests. (Closed) Base URL: https://ppapi.googlecode.com/svn/trunk/tests
Patch Set: First. Created 9 years, 11 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_url_loader.cc ('k') | ppapi/tests/test_var_deprecated.cc » ('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) 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_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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 ASSERT_TRUE(result.AsString() == "http://google.com/"); 58 ASSERT_TRUE(result.AsString() == "http://google.com/");
59 ASSERT_TRUE(ComponentEquals(c.scheme, 0, 4)); 59 ASSERT_TRUE(ComponentEquals(c.scheme, 0, 4));
60 ASSERT_TRUE(ComponentEquals(c.username, 0, -1)); 60 ASSERT_TRUE(ComponentEquals(c.username, 0, -1));
61 ASSERT_TRUE(ComponentEquals(c.password, 0, -1)); 61 ASSERT_TRUE(ComponentEquals(c.password, 0, -1));
62 ASSERT_TRUE(ComponentEquals(c.host, 7, 10)); 62 ASSERT_TRUE(ComponentEquals(c.host, 7, 10));
63 ASSERT_TRUE(ComponentEquals(c.port, 0, -1)); 63 ASSERT_TRUE(ComponentEquals(c.port, 0, -1));
64 ASSERT_TRUE(ComponentEquals(c.path, 17, 1)); 64 ASSERT_TRUE(ComponentEquals(c.path, 17, 1));
65 ASSERT_TRUE(ComponentEquals(c.query, 0, -1)); 65 ASSERT_TRUE(ComponentEquals(c.query, 0, -1));
66 ASSERT_TRUE(ComponentEquals(c.ref, 0, -1)); 66 ASSERT_TRUE(ComponentEquals(c.ref, 0, -1));
67 67
68 return std::string(); 68 PASS();
69 } 69 }
70 70
71 std::string TestUrlUtil::TestResolveRelative() { 71 std::string TestUrlUtil::TestResolveRelative() {
72 const int kTestCount = 6; 72 const int kTestCount = 6;
73 struct TestCase { 73 struct TestCase {
74 const char* base; 74 const char* base;
75 const char* relative; 75 const char* relative;
76 const char* expected; // NULL if 76 const char* expected; // NULL if
77 } test_cases[kTestCount] = { 77 } test_cases[kTestCount] = {
78 {"http://google.com/", "foo", "http://google.com/foo"}, 78 {"http://google.com/", "foo", "http://google.com/foo"},
79 {"http://google.com/foo", "/bar", "http://google.com/bar"}, 79 {"http://google.com/foo", "/bar", "http://google.com/bar"},
80 {"http://foo/", "http://bar", "http://bar/"}, 80 {"http://foo/", "http://bar", "http://bar/"},
81 {"data:foo", "/bar", NULL}, 81 {"data:foo", "/bar", NULL},
82 {"data:foo", "http://foo/", "http://foo/"}, 82 {"data:foo", "http://foo/", "http://foo/"},
83 {"http://foo/", "", "http://foo/"}, 83 {"http://foo/", "", "http://foo/"},
84 }; 84 };
85 85
86 for (int i = 0; i < kTestCount; i++) { 86 for (int i = 0; i < kTestCount; i++) {
87 pp::Var result = util_->ResolveRelativeToUrl(test_cases[i].base, 87 pp::Var result = util_->ResolveRelativeToUrl(test_cases[i].base,
88 test_cases[i].relative); 88 test_cases[i].relative);
89 if (test_cases[i].expected == NULL) { 89 if (test_cases[i].expected == NULL) {
90 ASSERT_TRUE(result.is_null()); 90 ASSERT_TRUE(result.is_null());
91 } else { 91 } else {
92 ASSERT_TRUE(result.AsString() == test_cases[i].expected); 92 ASSERT_TRUE(result.AsString() == test_cases[i].expected);
93 } 93 }
94 } 94 }
95 return std::string(); 95 PASS();
96 } 96 }
97 97
98 std::string TestUrlUtil::TestIsSameSecurityOrigin() { 98 std::string TestUrlUtil::TestIsSameSecurityOrigin() {
99 ASSERT_FALSE(util_->IsSameSecurityOrigin("http://google.com/", 99 ASSERT_FALSE(util_->IsSameSecurityOrigin("http://google.com/",
100 "http://example.com/")); 100 "http://example.com/"));
101 ASSERT_TRUE(util_->IsSameSecurityOrigin("http://google.com/foo", 101 ASSERT_TRUE(util_->IsSameSecurityOrigin("http://google.com/foo",
102 "http://google.com/bar")); 102 "http://google.com/bar"));
103 return std::string(); 103 PASS();
104 } 104 }
105 105
106 std::string TestUrlUtil::TestDocumentCanRequest() { 106 std::string TestUrlUtil::TestDocumentCanRequest() {
107 // This is hard to test, but we can at least verify we can't request 107 // This is hard to test, but we can at least verify we can't request
108 // some random domain. 108 // some random domain.
109 ASSERT_FALSE(util_->DocumentCanRequest(*instance_, "http://evil.com/")); 109 ASSERT_FALSE(util_->DocumentCanRequest(*instance_, "http://evil.com/"));
110 return std::string(); 110 PASS();
111 } 111 }
112 112
113 std::string TestUrlUtil::TestDocumentCanAccessDocument() { 113 std::string TestUrlUtil::TestDocumentCanAccessDocument() {
114 // This is hard to test, but we can at least verify we can access ourselves. 114 // This is hard to test, but we can at least verify we can access ourselves.
115 ASSERT_TRUE(util_->DocumentCanAccessDocument(*instance_, *instance_)); 115 ASSERT_TRUE(util_->DocumentCanAccessDocument(*instance_, *instance_));
116 return std::string(); 116 PASS();
117 } 117 }
OLDNEW
« no previous file with comments | « ppapi/tests/test_url_loader.cc ('k') | ppapi/tests/test_var_deprecated.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698