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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "extensions/browser/api/web_request/upload_data_presenter.h" | 10 #include "extensions/browser/api/web_request/upload_data_presenter.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // WebRequestFormDataParserTest. | 21 // WebRequestFormDataParserTest. |
22 TEST(WebRequestUploadDataPresenterTest, ParsedData) { | 22 TEST(WebRequestUploadDataPresenterTest, ParsedData) { |
23 // Input. | 23 // Input. |
24 const char block[] = "key.with.dots=value"; | 24 const char block[] = "key.with.dots=value"; |
25 net::UploadBytesElementReader element(block, sizeof(block) - 1); | 25 net::UploadBytesElementReader element(block, sizeof(block) - 1); |
26 | 26 |
27 // Expected output. | 27 // Expected output. |
28 std::unique_ptr<base::ListValue> values(new base::ListValue); | 28 std::unique_ptr<base::ListValue> values(new base::ListValue); |
29 values->AppendString("value"); | 29 values->AppendString("value"); |
30 base::DictionaryValue expected_form; | 30 base::DictionaryValue expected_form; |
31 expected_form.SetWithoutPathExpansion("key.with.dots", values.release()); | 31 expected_form.SetWithoutPathExpansion("key.with.dots", std::move(values)); |
32 | 32 |
33 // Real output. | 33 // Real output. |
34 std::unique_ptr<ParsedDataPresenter> parsed_data_presenter( | 34 std::unique_ptr<ParsedDataPresenter> parsed_data_presenter( |
35 ParsedDataPresenter::CreateForTests()); | 35 ParsedDataPresenter::CreateForTests()); |
36 ASSERT_TRUE(parsed_data_presenter.get() != NULL); | 36 ASSERT_TRUE(parsed_data_presenter.get() != NULL); |
37 parsed_data_presenter->FeedNext(element); | 37 parsed_data_presenter->FeedNext(element); |
38 EXPECT_TRUE(parsed_data_presenter->Succeeded()); | 38 EXPECT_TRUE(parsed_data_presenter->Succeeded()); |
39 std::unique_ptr<base::Value> result = parsed_data_presenter->Result(); | 39 std::unique_ptr<base::Value> result = parsed_data_presenter->Result(); |
40 ASSERT_TRUE(result.get() != NULL); | 40 ASSERT_TRUE(result.get() != NULL); |
41 | 41 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 raw_presenter.FeedNextFile(kFilename); | 75 raw_presenter.FeedNextFile(kFilename); |
76 raw_presenter.FeedNextBytes(block2, block2_size); | 76 raw_presenter.FeedNextBytes(block2, block2_size); |
77 EXPECT_TRUE(raw_presenter.Succeeded()); | 77 EXPECT_TRUE(raw_presenter.Succeeded()); |
78 std::unique_ptr<base::Value> result = raw_presenter.Result(); | 78 std::unique_ptr<base::Value> result = raw_presenter.Result(); |
79 ASSERT_TRUE(result.get() != NULL); | 79 ASSERT_TRUE(result.get() != NULL); |
80 | 80 |
81 EXPECT_TRUE(result->Equals(&expected_list)); | 81 EXPECT_TRUE(result->Equals(&expected_list)); |
82 } | 82 } |
83 | 83 |
84 } // namespace extensions | 84 } // namespace extensions |
OLD | NEW |