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

Side by Side Diff: chrome/browser/chromeos/system_access_unittest.cc

Issue 6902107: Merge 82987, 83304 - make sure that OEM tab is shown even if first login is Guest (Closed) Base URL: svn://svn.chromium.org/chrome/branches/742/src/
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/system_access.h"
6
7 #include "base/basictypes.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace chromeos {
11 namespace system_access {
12
13 TEST(SystemAccessTest, TestGetSingleValueFromTool) {
14 MachineInfo machine_info;
15 NameValuePairsParser parser(&machine_info);
16 const char* command[] = { "echo", "Foo" };
17 EXPECT_TRUE(parser.GetSingleValueFromTool(arraysize(command), command,
18 "foo"));
19 ASSERT_EQ(1U, machine_info.size());
20 EXPECT_EQ("Foo", machine_info["foo"]);
21 }
22
23 TEST(SystemAccessTest, TestParseNameValuePairsFromTool) {
24 MachineInfo machine_info;
25 NameValuePairsParser parser(&machine_info);
26 const char* command1[] = { "echo", "foo=Foo bar=Bar\nfoobar=FooBar\n" };
27 EXPECT_TRUE(parser.ParseNameValuePairsFromTool(
28 arraysize(command1), command1, "=", " \n"));
29 ASSERT_EQ(3U, machine_info.size());
30 EXPECT_EQ("Foo", machine_info["foo"]);
31 EXPECT_EQ("Bar", machine_info["bar"]);
32 EXPECT_EQ("FooBar", machine_info["foobar"]);
33
34 machine_info.clear();
35 const char* command2[] = { "echo", "foo=Foo,bar=Bar" };
36 EXPECT_TRUE(parser.ParseNameValuePairsFromTool(
37 arraysize(command2), command2, "=", ",\n"));
38 ASSERT_EQ(2U, machine_info.size());
39 EXPECT_EQ("Foo", machine_info["foo"]);
40 EXPECT_EQ("Bar", machine_info["bar"]);
41
42 machine_info.clear();
43 const char* command3[] = { "echo", "foo=Foo=foo,bar=Bar" };
44 EXPECT_FALSE(parser.ParseNameValuePairsFromTool(
45 arraysize(command3), command3, "=", ",\n"));
46
47 machine_info.clear();
48 const char* command4[] = { "echo", "foo=Foo,=Bar" };
49 EXPECT_FALSE(parser.ParseNameValuePairsFromTool(
50 arraysize(command4), command4, "=", ",\n"));
51 }
52
53 } // namespace system_access
54 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system_access.cc ('k') | chrome/browser/extensions/extension_info_private_api_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698