Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: content/renderer/java/gin_java_bridge_value_converter_unittest.cc

Issue 1076443002: Removed obsolete float_util.h as VS2013 supports standards well enough. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fixed mistake in value converter. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <cmath>
6
5 #include "base/basictypes.h" 7 #include "base/basictypes.h"
6 #include "base/float_util.h"
7 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
9 #include "content/common/android/gin_java_bridge_value.h" 10 #include "content/common/android/gin_java_bridge_value.h"
10 #include "content/renderer/java/gin_java_bridge_value_converter.h" 11 #include "content/renderer/java/gin_java_bridge_value_converter.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 #include "v8/include/v8.h" 13 #include "v8/include/v8.h"
13 14
14 namespace content { 15 namespace content {
15 16
16 class GinJavaBridgeValueConverterTest : public testing::Test { 17 class GinJavaBridgeValueConverterTest : public testing::Test {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 ASSERT_TRUE(infinity.get()); 61 ASSERT_TRUE(infinity.get());
61 EXPECT_TRUE( 62 EXPECT_TRUE(
62 GinJavaBridgeValue::ContainsGinJavaBridgeValue(infinity.get())); 63 GinJavaBridgeValue::ContainsGinJavaBridgeValue(infinity.get()));
63 scoped_ptr<const GinJavaBridgeValue> infinity_value( 64 scoped_ptr<const GinJavaBridgeValue> infinity_value(
64 GinJavaBridgeValue::FromValue(infinity.get())); 65 GinJavaBridgeValue::FromValue(infinity.get()));
65 ASSERT_TRUE(infinity_value.get()); 66 ASSERT_TRUE(infinity_value.get());
66 float native_float; 67 float native_float;
67 EXPECT_TRUE( 68 EXPECT_TRUE(
68 infinity_value->IsType(GinJavaBridgeValue::TYPE_NONFINITE)); 69 infinity_value->IsType(GinJavaBridgeValue::TYPE_NONFINITE));
69 EXPECT_TRUE(infinity_value->GetAsNonFinite(&native_float)); 70 EXPECT_TRUE(infinity_value->GetAsNonFinite(&native_float));
70 EXPECT_FALSE(base::IsFinite(native_float)); 71 EXPECT_TRUE(std::isinf(native_float));
71 EXPECT_FALSE(base::IsNaN(native_float));
72 } 72 }
73 73
74 TEST_F(GinJavaBridgeValueConverterTest, ArrayBuffer) { 74 TEST_F(GinJavaBridgeValueConverterTest, ArrayBuffer) {
75 v8::HandleScope handle_scope(isolate_); 75 v8::HandleScope handle_scope(isolate_);
76 v8::Local<v8::Context> context = 76 v8::Local<v8::Context> context =
77 v8::Local<v8::Context>::New(isolate_, context_); 77 v8::Local<v8::Context>::New(isolate_, context_);
78 v8::Context::Scope context_scope(context); 78 v8::Context::Scope context_scope(context);
79 79
80 scoped_ptr<GinJavaBridgeValueConverter> converter( 80 scoped_ptr<GinJavaBridgeValueConverter> converter(
81 new GinJavaBridgeValueConverter()); 81 new GinJavaBridgeValueConverter());
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 base::ListValue* list; 127 base::ListValue* list;
128 ASSERT_TRUE(list_value->GetAsList(&list)) << typed_array_type; 128 ASSERT_TRUE(list_value->GetAsList(&list)) << typed_array_type;
129 EXPECT_EQ(1u, list->GetSize()) << typed_array_type; 129 EXPECT_EQ(1u, list->GetSize()) << typed_array_type;
130 double first_element; 130 double first_element;
131 ASSERT_TRUE(list->GetDouble(0, &first_element)) << typed_array_type; 131 ASSERT_TRUE(list->GetDouble(0, &first_element)) << typed_array_type;
132 EXPECT_EQ(42.0, first_element) << typed_array_type; 132 EXPECT_EQ(42.0, first_element) << typed_array_type;
133 } 133 }
134 } 134 }
135 135
136 } // namespace content 136 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698