| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/strings/safe_sprintf.h" | 5 #include "base/strings/safe_sprintf.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 7 #include <stdio.h> | 9 #include <stdio.h> |
| 8 #include <string.h> | 10 #include <string.h> |
| 9 | 11 |
| 10 #include <limits> | 12 #include <limits> |
| 11 | 13 |
| 12 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "build/build_config.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 19 |
| 16 // Death tests on Android are currently very flaky. No need to add more flaky | 20 // Death tests on Android are currently very flaky. No need to add more flaky |
| 17 // tests, as they just make it hard to spot real problems. | 21 // tests, as they just make it hard to spot real problems. |
| 18 // TODO(markus): See if the restrictions on Android can eventually be lifted. | 22 // TODO(markus): See if the restrictions on Android can eventually be lifted. |
| 19 #if defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) | 23 #if defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) |
| 20 #define ALLOW_DEATH_TEST | 24 #define ALLOW_DEATH_TEST |
| 21 #endif | 25 #endif |
| 22 | 26 |
| 23 namespace base { | 27 namespace base { |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 void *ptr = str; | 754 void *ptr = str; |
| 751 char buf[40]; | 755 char buf[40]; |
| 752 EXPECT_EQ(10, SafeSPrintf(buf, "%p", str)); | 756 EXPECT_EQ(10, SafeSPrintf(buf, "%p", str)); |
| 753 EXPECT_EQ("0x80000000", std::string(buf)); | 757 EXPECT_EQ("0x80000000", std::string(buf)); |
| 754 EXPECT_EQ(10, SafeSPrintf(buf, "%p", ptr)); | 758 EXPECT_EQ(10, SafeSPrintf(buf, "%p", ptr)); |
| 755 EXPECT_EQ("0x80000000", std::string(buf)); | 759 EXPECT_EQ("0x80000000", std::string(buf)); |
| 756 } | 760 } |
| 757 | 761 |
| 758 } // namespace strings | 762 } // namespace strings |
| 759 } // namespace base | 763 } // namespace base |
| OLD | NEW |