OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // Fuzzer for content/renderer | 5 // Fuzzer for content/renderer |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <memory> | 10 #include <memory> |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 AttrPosition PickRandomAttribute(Random* rnd); | 151 AttrPosition PickRandomAttribute(Random* rnd); |
152 | 152 |
153 void ParseJson(const base::Value& value) { | 153 void ParseJson(const base::Value& value) { |
154 const base::ListValue* list; | 154 const base::ListValue* list; |
155 if (!value.GetAsList(&list)) { | 155 if (!value.GetAsList(&list)) { |
156 return; | 156 return; |
157 } | 157 } |
158 | 158 |
159 for (const auto& listItem : *list) { | 159 for (const auto& listItem : *list) { |
160 std::unique_ptr<Node> node(Node::ParseJson(*listItem)); | 160 std::unique_ptr<Node> node(Node::ParseJson(listItem)); |
161 if (node) { | 161 if (node) { |
162 push_back(std::move(node)); | 162 push_back(std::move(node)); |
163 } | 163 } |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
167 private: | 167 private: |
168 friend class Element; | 168 friend class Element; |
169 | 169 |
170 DISALLOW_COPY_AND_ASSIGN(NodeList); | 170 DISALLOW_COPY_AND_ASSIGN(NodeList); |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 | 586 |
587 auto nodes = NodeList::ParseJsonString(data, size); | 587 auto nodes = NodeList::ParseJsonString(data, size); |
588 std::string html; | 588 std::string html; |
589 nodes->WriteHtml(&html); | 589 nodes->WriteHtml(&html); |
590 | 590 |
591 env->adapter->LoadHTML(html, "http://www.example.org"); | 591 env->adapter->LoadHTML(html, "http://www.example.org"); |
592 return 0; | 592 return 0; |
593 } | 593 } |
594 | 594 |
595 } // namespace content | 595 } // namespace content |
OLD | NEW |