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