OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/common/android/gin_java_bridge_value.h" | 5 #include "content/common/android/gin_java_bridge_value.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <memory> | 10 #include <memory> |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 GinJavaBridgeValue::FromValue(object_id.get())); | 71 GinJavaBridgeValue::FromValue(object_id.get())); |
72 ASSERT_TRUE(object_id_value.get()); | 72 ASSERT_TRUE(object_id_value.get()); |
73 EXPECT_TRUE(object_id_value->IsType(GinJavaBridgeValue::TYPE_OBJECT_ID)); | 73 EXPECT_TRUE(object_id_value->IsType(GinJavaBridgeValue::TYPE_OBJECT_ID)); |
74 EXPECT_TRUE(object_id_value->GetAsObjectID(&native_object_id)); | 74 EXPECT_TRUE(object_id_value->GetAsObjectID(&native_object_id)); |
75 EXPECT_EQ(42, native_object_id); | 75 EXPECT_EQ(42, native_object_id); |
76 | 76 |
77 EXPECT_FALSE(undefined_value->GetAsNonFinite(&native_float)); | 77 EXPECT_FALSE(undefined_value->GetAsNonFinite(&native_float)); |
78 } | 78 } |
79 | 79 |
80 TEST_F(GinJavaBridgeValueTest, BrokenValues) { | 80 TEST_F(GinJavaBridgeValueTest, BrokenValues) { |
81 std::unique_ptr<base::Value> non_binary(new base::FundamentalValue(42)); | 81 std::unique_ptr<base::Value> non_binary(new base::Value(42)); |
82 EXPECT_FALSE( | 82 EXPECT_FALSE( |
83 GinJavaBridgeValue::ContainsGinJavaBridgeValue(non_binary.get())); | 83 GinJavaBridgeValue::ContainsGinJavaBridgeValue(non_binary.get())); |
84 | 84 |
85 const char dummy_data[] = "\000\001\002\003\004\005\006\007\010\011\012\013"; | 85 const char dummy_data[] = "\000\001\002\003\004\005\006\007\010\011\012\013"; |
86 std::unique_ptr<base::BinaryValue> broken_binary( | 86 std::unique_ptr<base::BinaryValue> broken_binary( |
87 base::BinaryValue::CreateWithCopiedBuffer(dummy_data, | 87 base::BinaryValue::CreateWithCopiedBuffer(dummy_data, |
88 sizeof(dummy_data))); | 88 sizeof(dummy_data))); |
89 EXPECT_FALSE( | 89 EXPECT_FALSE( |
90 GinJavaBridgeValue::ContainsGinJavaBridgeValue(broken_binary.get())); | 90 GinJavaBridgeValue::ContainsGinJavaBridgeValue(broken_binary.get())); |
91 } | 91 } |
92 | 92 |
93 } // namespace | 93 } // namespace |
OLD | NEW |