| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/strings/string_piece.h" | 7 #include "base/strings/string_piece.h" |
| 8 #include "chrome/browser/extensions/api/web_request/form_data_parser.h" | 8 #include "extensions/browser/api/web_request/form_data_parser.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace extensions { | 11 namespace extensions { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 // Attempts to create a parser corresponding to the |content_type_header|. | 15 // Attempts to create a parser corresponding to the |content_type_header|. |
| 16 // On success, returns the parser. | 16 // On success, returns the parser. |
| 17 scoped_ptr<FormDataParser> InitParser(const std::string& content_type_header) { | 17 scoped_ptr<FormDataParser> InitParser(const std::string& content_type_header) { |
| 18 scoped_ptr<FormDataParser> parser( | 18 scoped_ptr<FormDataParser> parser( |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // Fourth test: empty URL-encoded POST data. Note that an empty string is a | 241 // Fourth test: empty URL-encoded POST data. Note that an empty string is a |
| 242 // valid url-encoded value, so this should parse correctly. | 242 // valid url-encoded value, so this should parse correctly. |
| 243 std::vector<std::string> output; | 243 std::vector<std::string> output; |
| 244 input.clear(); | 244 input.clear(); |
| 245 input.push_back(&kUrlEncodedBytesEmpty); | 245 input.push_back(&kUrlEncodedBytesEmpty); |
| 246 EXPECT_TRUE(RunParser(kUrlEncoded, input, &output)); | 246 EXPECT_TRUE(RunParser(kUrlEncoded, input, &output)); |
| 247 EXPECT_EQ(0u, output.size()); | 247 EXPECT_EQ(0u, output.size()); |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace extensions | 250 } // namespace extensions |
| OLD | NEW |