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

Side by Side Diff: mojo/edk/js/tests/js_to_cpp_tests.cc

Issue 1543603002: Switch to standard integer types in mojo/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 12 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
« no previous file with comments | « mojo/edk/js/test/run_js_tests.cc ('k') | mojo/edk/js/waiting_callback.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h>
6 #include <stdint.h>
7
5 #include <utility> 8 #include <utility>
6 9
7 #include "base/at_exit.h" 10 #include "base/at_exit.h"
8 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
10 #include "base/macros.h" 13 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h" 15 #include "base/run_loop.h"
13 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
14 #include "gin/array_buffer.h" 17 #include "gin/array_buffer.h"
15 #include "gin/public/isolate_holder.h" 18 #include "gin/public/isolate_holder.h"
16 #include "mojo/edk/js/mojo_runner_delegate.h" 19 #include "mojo/edk/js/mojo_runner_delegate.h"
17 #include "mojo/edk/js/tests/js_to_cpp.mojom.h" 20 #include "mojo/edk/js/tests/js_to_cpp.mojom.h"
18 #include "mojo/edk/test/test_utils.h" 21 #include "mojo/edk/test/test_utils.h"
19 #include "mojo/public/cpp/bindings/binding.h" 22 #include "mojo/public/cpp/bindings/binding.h"
20 #include "mojo/public/cpp/system/core.h" 23 #include "mojo/public/cpp/system/core.h"
21 #include "mojo/public/cpp/system/macros.h" 24 #include "mojo/public/cpp/system/macros.h"
22 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
23 26
24 namespace mojo { 27 namespace mojo {
25 namespace edk { 28 namespace edk {
26 29
27 // Global value updated by some checks to prevent compilers from optimizing 30 // Global value updated by some checks to prevent compilers from optimizing
28 // reads out of existence. 31 // reads out of existence.
29 uint32 g_waste_accumulator = 0; 32 uint32_t g_waste_accumulator = 0;
30 33
31 namespace { 34 namespace {
32 35
33 // Negative numbers with different values in each byte, the last of 36 // Negative numbers with different values in each byte, the last of
34 // which can survive promotion to double and back. 37 // which can survive promotion to double and back.
35 const int8 kExpectedInt8Value = -65; 38 const int8_t kExpectedInt8Value = -65;
36 const int16 kExpectedInt16Value = -16961; 39 const int16_t kExpectedInt16Value = -16961;
37 const int32 kExpectedInt32Value = -1145258561; 40 const int32_t kExpectedInt32Value = -1145258561;
38 const int64 kExpectedInt64Value = -77263311946305LL; 41 const int64_t kExpectedInt64Value = -77263311946305LL;
39 42
40 // Positive numbers with different values in each byte, the last of 43 // Positive numbers with different values in each byte, the last of
41 // which can survive promotion to double and back. 44 // which can survive promotion to double and back.
42 const uint8 kExpectedUInt8Value = 65; 45 const uint8_t kExpectedUInt8Value = 65;
43 const uint16 kExpectedUInt16Value = 16961; 46 const uint16_t kExpectedUInt16Value = 16961;
44 const uint32 kExpectedUInt32Value = 1145258561; 47 const uint32_t kExpectedUInt32Value = 1145258561;
45 const uint64 kExpectedUInt64Value = 77263311946305LL; 48 const uint64_t kExpectedUInt64Value = 77263311946305LL;
46 49
47 // Double/float values, including special case constants. 50 // Double/float values, including special case constants.
48 const double kExpectedDoubleVal = 3.14159265358979323846; 51 const double kExpectedDoubleVal = 3.14159265358979323846;
49 const double kExpectedDoubleInf = std::numeric_limits<double>::infinity(); 52 const double kExpectedDoubleInf = std::numeric_limits<double>::infinity();
50 const double kExpectedDoubleNan = std::numeric_limits<double>::quiet_NaN(); 53 const double kExpectedDoubleNan = std::numeric_limits<double>::quiet_NaN();
51 const float kExpectedFloatVal = static_cast<float>(kExpectedDoubleVal); 54 const float kExpectedFloatVal = static_cast<float>(kExpectedDoubleVal);
52 const float kExpectedFloatInf = std::numeric_limits<float>::infinity(); 55 const float kExpectedFloatInf = std::numeric_limits<float>::infinity();
53 const float kExpectedFloatNan = std::numeric_limits<float>::quiet_NaN(); 56 const float kExpectedFloatNan = std::numeric_limits<float>::quiet_NaN();
54 57
55 // NaN has the property that it is not equal to itself. 58 // NaN has the property that it is not equal to itself.
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 424 }
422 425
423 TEST_F(JsToCppTest, BackPointer) { 426 TEST_F(JsToCppTest, BackPointer) {
424 BackPointerCppSideConnection cpp_side_connection; 427 BackPointerCppSideConnection cpp_side_connection;
425 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); 428 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection);
426 EXPECT_TRUE(cpp_side_connection.DidSucceed()); 429 EXPECT_TRUE(cpp_side_connection.DidSucceed());
427 } 430 }
428 431
429 } // namespace edk 432 } // namespace edk
430 } // namespace mojo 433 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/js/test/run_js_tests.cc ('k') | mojo/edk/js/waiting_callback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698