| Index: content/browser/webui/web_ui_mojo_browsertest.cc
|
| diff --git a/content/browser/webui/web_ui_mojo_browsertest.cc b/content/browser/webui/web_ui_mojo_browsertest.cc
|
| index 5a1fb3a69f4b62f1f33a0454be1da6277e83065a..e565bd49fecc629de6963be6599804cc9df6fdaa 100644
|
| --- a/content/browser/webui/web_ui_mojo_browsertest.cc
|
| +++ b/content/browser/webui/web_ui_mojo_browsertest.cc
|
| @@ -2,6 +2,9 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include <math.h>
|
| +#include <limits>
|
| +
|
| #include "base/command_line.h"
|
| #include "base/file_util.h"
|
| #include "base/files/file_path.h"
|
| @@ -47,6 +50,17 @@ const uint16 kExpectedUInt16Value = 16961;
|
| const uint32 kExpectedUInt32Value = 1145258561;
|
| const uint64 kExpectedUInt64Value = 77263311946305LL;
|
|
|
| +// Float/double values, including special case constants.
|
| +const float kExpectedFloatVal = static_cast<float>(M_PI);
|
| +const float kExpectedFloatInf = std::numeric_limits<float>::infinity();
|
| +const float kExpectedFloatNan = std::numeric_limits<float>::quiet_NaN();
|
| +const double kExpectedDoubleVal = M_PI;
|
| +const double kExpectedDoubleInf = std::numeric_limits<double>::infinity();
|
| +const double kExpectedDoubleNan = std::numeric_limits<double>::quiet_NaN();
|
| +
|
| +// NaN has the property that it is not equal to itself.
|
| +#define EXPECT_NAN(x) EXPECT_NE(x, x)
|
| +
|
| // Returns the path to the mojom js bindings file.
|
| base::FilePath GetFilePathForJSResource(const std::string& path) {
|
| std::string binding_path = "gen/" + path + ".js";
|
| @@ -144,6 +158,12 @@ class EchoBrowserTargetImpl : public BrowserTargetImpl {
|
| builder.set_ui32(kExpectedUInt32Value);
|
| builder.set_ui16(kExpectedUInt16Value);
|
| builder.set_ui8(kExpectedUInt8Value);
|
| + builder.set_float_val(kExpectedFloatVal);
|
| + builder.set_float_inf(kExpectedFloatInf);
|
| + builder.set_float_nan(kExpectedFloatNan);
|
| + builder.set_double_val(kExpectedDoubleVal);
|
| + builder.set_double_inf(kExpectedDoubleInf);
|
| + builder.set_double_nan(kExpectedDoubleNan);
|
| builder.set_name("coming");
|
| client_->Echo(builder.Finish());
|
| }
|
| @@ -162,6 +182,12 @@ class EchoBrowserTargetImpl : public BrowserTargetImpl {
|
| EXPECT_EQ(kExpectedUInt32Value, arg1.ui32());
|
| EXPECT_EQ(kExpectedUInt16Value, arg1.ui16());
|
| EXPECT_EQ(kExpectedUInt8Value, arg1.ui8());
|
| + EXPECT_EQ(kExpectedFloatVal, arg1.float_val());
|
| + EXPECT_EQ(kExpectedFloatInf, arg1.float_inf());
|
| + EXPECT_NAN(arg1.float_nan());
|
| + EXPECT_EQ(kExpectedDoubleVal, arg1.double_val());
|
| + EXPECT_EQ(kExpectedDoubleInf, arg1.double_inf());
|
| + EXPECT_NAN(arg1.double_nan());
|
| EXPECT_EQ(std::string("coming"), arg1.name().To<std::string>());
|
|
|
| EXPECT_EQ(-1, arg2.si64());
|
|
|