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 "base/format_macros.h" | 5 #include "base/format_macros.h" |
6 #include "base/json/json_reader.h" | 6 #include "base/json/json_reader.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/test/webdriver/commands/response.h" | 10 #include "chrome/test/webdriver/commands/response.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 class ParseRequestInfoTest : public testing::Test { | 152 class ParseRequestInfoTest : public testing::Test { |
153 public: | 153 public: |
154 static char kGet[]; | 154 static char kGet[]; |
155 static char kTestPath[]; | 155 static char kTestPath[]; |
156 | 156 |
157 ParseRequestInfoTest() {} | 157 ParseRequestInfoTest() {} |
158 virtual ~ParseRequestInfoTest() {} | 158 virtual ~ParseRequestInfoTest() {} |
159 | 159 |
160 virtual void TearDown() { | 160 virtual void TearDown() { |
161 SessionManager::GetInstance()->set_url_base(""); | 161 SessionManager::GetInstance()->set_url_base(std::string()); |
162 } | 162 } |
163 | 163 |
164 private: | 164 private: |
165 DISALLOW_COPY_AND_ASSIGN(ParseRequestInfoTest); | 165 DISALLOW_COPY_AND_ASSIGN(ParseRequestInfoTest); |
166 }; | 166 }; |
167 | 167 |
168 char ParseRequestInfoTest::kGet[] = "GET"; | 168 char ParseRequestInfoTest::kGet[] = "GET"; |
169 char ParseRequestInfoTest::kTestPath[] = "/foo/bar/baz"; | 169 char ParseRequestInfoTest::kTestPath[] = "/foo/bar/baz"; |
170 | 170 |
171 TEST_F(ParseRequestInfoTest, ParseRequestWithEmptyUrlBase) { | 171 TEST_F(ParseRequestInfoTest, ParseRequestWithEmptyUrlBase) { |
172 struct mg_request_info request_info; | 172 struct mg_request_info request_info; |
173 request_info.request_method = kGet; | 173 request_info.request_method = kGet; |
174 request_info.uri = kTestPath; | 174 request_info.uri = kTestPath; |
175 | 175 |
176 std::string method; | 176 std::string method; |
177 std::vector<std::string> path_segments; | 177 std::vector<std::string> path_segments; |
178 base::DictionaryValue* parameters; | 178 base::DictionaryValue* parameters; |
179 Response response; | 179 Response response; |
180 | 180 |
181 SessionManager::GetInstance()->set_url_base(""); | 181 SessionManager::GetInstance()->set_url_base(std::string()); |
182 EXPECT_TRUE(internal::ParseRequestInfo( | 182 EXPECT_TRUE(internal::ParseRequestInfo( |
183 &request_info, | 183 &request_info, |
184 NULL, // NULL is ok because GET not POST is used | 184 NULL, // NULL is ok because GET not POST is used |
185 &method, | 185 &method, |
186 &path_segments, | 186 &path_segments, |
187 ¶meters, | 187 ¶meters, |
188 &response)); | 188 &response)); |
189 EXPECT_EQ("GET", method); | 189 EXPECT_EQ("GET", method); |
190 ASSERT_EQ(4u, path_segments.size()); | 190 ASSERT_EQ(4u, path_segments.size()); |
191 EXPECT_EQ("", path_segments[0]); | 191 EXPECT_EQ("", path_segments[0]); |
(...skipping 21 matching lines...) Expand all Loading... |
213 ¶meters, | 213 ¶meters, |
214 &response)); | 214 &response)); |
215 EXPECT_EQ("GET", method); | 215 EXPECT_EQ("GET", method); |
216 ASSERT_EQ(3u, path_segments.size()); | 216 ASSERT_EQ(3u, path_segments.size()); |
217 EXPECT_EQ("", path_segments[0]); | 217 EXPECT_EQ("", path_segments[0]); |
218 EXPECT_EQ("bar", path_segments[1]); | 218 EXPECT_EQ("bar", path_segments[1]); |
219 EXPECT_EQ("baz", path_segments[2]); | 219 EXPECT_EQ("baz", path_segments[2]); |
220 } | 220 } |
221 | 221 |
222 } // namespace webdriver | 222 } // namespace webdriver |
OLD | NEW |