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

Unified Diff: base/sys_info_unittest.cc

Issue 2860663005: Implement SysInfo::HardwareModelName() on iOS. (Closed)
Patch Set: Use different simulator macro. Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/sys_info_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sys_info_unittest.cc
diff --git a/base/sys_info_unittest.cc b/base/sys_info_unittest.cc
index 94b5a8497167483ad74d3c841364c91be817c248..d9fc6a9df85eb2989624ed2c5ea89e4e6695a867 100644
--- a/base/sys_info_unittest.cc
+++ b/base/sys_info_unittest.cc
@@ -7,6 +7,8 @@
#include "base/environment.h"
#include "base/files/file_util.h"
#include "base/process/process_metrics.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_split.h"
#include "base/sys_info.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
@@ -95,10 +97,17 @@ TEST_F(SysInfoTest, Uptime) {
EXPECT_GT(up_time_2.InMicroseconds(), up_time_1.InMicroseconds());
}
-#if defined(OS_MACOSX) && !defined(OS_IOS)
-TEST_F(SysInfoTest, HardwareModelName) {
+#if defined(OS_MACOSX)
+TEST_F(SysInfoTest, HardwareModelNameFormatMacAndiOS) {
std::string hardware_model = SysInfo::HardwareModelName();
- EXPECT_FALSE(hardware_model.empty());
+ ASSERT_FALSE(hardware_model.empty());
+ // Check that the model is of the expected format "Foo,Bar" where "Bar" is
+ // a number.
+ std::vector<StringPiece> pieces =
+ SplitStringPiece(hardware_model, ",", KEEP_WHITESPACE, SPLIT_WANT_ALL);
+ ASSERT_EQ(2u, pieces.size()) << hardware_model;
+ int value;
+ EXPECT_TRUE(StringToInt(pieces[1], &value)) << hardware_model;
}
#endif
« no previous file with comments | « base/sys_info_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698