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 #include "base/json/json_reader.h" | 5 #include "base/json/json_reader.h" |
6 #include "headless/public/devtools/domains/accessibility.h" | 6 #include "headless/public/devtools/domains/accessibility.h" |
7 #include "headless/public/devtools/domains/memory.h" | 7 #include "headless/public/devtools/domains/memory.h" |
8 #include "headless/public/devtools/domains/page.h" | 8 #include "headless/public/devtools/domains/page.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 EXPECT_TRUE(object); | 188 EXPECT_TRUE(object); |
189 | 189 |
190 #if DCHECK_IS_ON() | 190 #if DCHECK_IS_ON() |
191 ErrorReporter errors; | 191 ErrorReporter errors; |
192 EXPECT_FALSE(runtime::EvaluateResult::Parse(*object, &errors)); | 192 EXPECT_FALSE(runtime::EvaluateResult::Parse(*object, &errors)); |
193 EXPECT_TRUE(errors.HasErrors()); | 193 EXPECT_TRUE(errors.HasErrors()); |
194 #endif // DCHECK_IS_ON() | 194 #endif // DCHECK_IS_ON() |
195 } | 195 } |
196 | 196 |
197 TEST(TypesTest, AnyProperty) { | 197 TEST(TypesTest, AnyProperty) { |
198 std::unique_ptr<base::Value> value(new base::FundamentalValue(123)); | 198 std::unique_ptr<base::Value> value(new base::Value(123)); |
199 std::unique_ptr<accessibility::AXValue> object( | 199 std::unique_ptr<accessibility::AXValue> object( |
200 accessibility::AXValue::Builder() | 200 accessibility::AXValue::Builder() |
201 .SetType(accessibility::AXValueType::INTEGER) | 201 .SetType(accessibility::AXValueType::INTEGER) |
202 .SetValue(std::move(value)) | 202 .SetValue(std::move(value)) |
203 .Build()); | 203 .Build()); |
204 EXPECT_TRUE(object); | 204 EXPECT_TRUE(object); |
205 EXPECT_EQ(base::Value::TYPE_INTEGER, object->GetValue()->GetType()); | 205 EXPECT_EQ(base::Value::TYPE_INTEGER, object->GetValue()->GetType()); |
206 | 206 |
207 std::unique_ptr<accessibility::AXValue> clone(object->Clone()); | 207 std::unique_ptr<accessibility::AXValue> clone(object->Clone()); |
208 EXPECT_TRUE(clone); | 208 EXPECT_TRUE(clone); |
209 EXPECT_EQ(base::Value::TYPE_INTEGER, clone->GetValue()->GetType()); | 209 EXPECT_EQ(base::Value::TYPE_INTEGER, clone->GetValue()->GetType()); |
210 | 210 |
211 int clone_value; | 211 int clone_value; |
212 EXPECT_TRUE(clone->GetValue()->GetAsInteger(&clone_value)); | 212 EXPECT_TRUE(clone->GetValue()->GetAsInteger(&clone_value)); |
213 EXPECT_EQ(123, clone_value); | 213 EXPECT_EQ(123, clone_value); |
214 } | 214 } |
215 | 215 |
216 } // namespace headless | 216 } // namespace headless |
OLD | NEW |