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

Side by Side Diff: base/process_util_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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
« no previous file with comments | « base/process_util_linux.cc ('k') | base/string_util_unittest.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #define _CRT_SECURE_NO_WARNINGS 5 #define _CRT_SECURE_NO_WARNINGS
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 const int no_clone_flags = 0; 751 const int no_clone_flags = 0;
752 752
753 env_changes.push_back(std::make_pair(std::string("BASE_TEST"), 753 env_changes.push_back(std::make_pair(std::string("BASE_TEST"),
754 std::string("bar"))); 754 std::string("bar")));
755 EXPECT_EQ("bar\n", TestLaunchProcess(env_changes, no_clone_flags)); 755 EXPECT_EQ("bar\n", TestLaunchProcess(env_changes, no_clone_flags));
756 env_changes.clear(); 756 env_changes.clear();
757 757
758 EXPECT_EQ(0, setenv("BASE_TEST", "testing", 1 /* override */)); 758 EXPECT_EQ(0, setenv("BASE_TEST", "testing", 1 /* override */));
759 EXPECT_EQ("testing\n", TestLaunchProcess(env_changes, no_clone_flags)); 759 EXPECT_EQ("testing\n", TestLaunchProcess(env_changes, no_clone_flags));
760 760
761 env_changes.push_back(std::make_pair(std::string("BASE_TEST"), 761 env_changes.push_back(
762 std::string(""))); 762 std::make_pair(std::string("BASE_TEST"), std::string()));
763 EXPECT_EQ("\n", TestLaunchProcess(env_changes, no_clone_flags)); 763 EXPECT_EQ("\n", TestLaunchProcess(env_changes, no_clone_flags));
764 764
765 env_changes[0].second = "foo"; 765 env_changes[0].second = "foo";
766 EXPECT_EQ("foo\n", TestLaunchProcess(env_changes, no_clone_flags)); 766 EXPECT_EQ("foo\n", TestLaunchProcess(env_changes, no_clone_flags));
767 767
768 env_changes.clear(); 768 env_changes.clear();
769 EXPECT_EQ(0, setenv("BASE_TEST", kLargeString, 1 /* override */)); 769 EXPECT_EQ(0, setenv("BASE_TEST", kLargeString, 1 /* override */));
770 EXPECT_EQ(std::string(kLargeString) + "\n", 770 EXPECT_EQ(std::string(kLargeString) + "\n",
771 TestLaunchProcess(env_changes, no_clone_flags)); 771 TestLaunchProcess(env_changes, no_clone_flags));
772 772
(...skipping 20 matching lines...) Expand all
793 EXPECT_TRUE(e[0] == NULL); 793 EXPECT_TRUE(e[0] == NULL);
794 delete[] e; 794 delete[] e;
795 795
796 changes.push_back(std::make_pair(std::string("A"), std::string("1"))); 796 changes.push_back(std::make_pair(std::string("A"), std::string("1")));
797 e = base::AlterEnvironment(changes, empty); 797 e = base::AlterEnvironment(changes, empty);
798 EXPECT_EQ(std::string("A=1"), e[0]); 798 EXPECT_EQ(std::string("A=1"), e[0]);
799 EXPECT_TRUE(e[1] == NULL); 799 EXPECT_TRUE(e[1] == NULL);
800 delete[] e; 800 delete[] e;
801 801
802 changes.clear(); 802 changes.clear();
803 changes.push_back(std::make_pair(std::string("A"), std::string(""))); 803 changes.push_back(std::make_pair(std::string("A"), std::string()));
804 e = base::AlterEnvironment(changes, empty); 804 e = base::AlterEnvironment(changes, empty);
805 EXPECT_TRUE(e[0] == NULL); 805 EXPECT_TRUE(e[0] == NULL);
806 delete[] e; 806 delete[] e;
807 807
808 changes.clear(); 808 changes.clear();
809 e = base::AlterEnvironment(changes, a2); 809 e = base::AlterEnvironment(changes, a2);
810 EXPECT_EQ(std::string("A=2"), e[0]); 810 EXPECT_EQ(std::string("A=2"), e[0]);
811 EXPECT_TRUE(e[1] == NULL); 811 EXPECT_TRUE(e[1] == NULL);
812 delete[] e; 812 delete[] e;
813 813
814 changes.clear(); 814 changes.clear();
815 changes.push_back(std::make_pair(std::string("A"), std::string("1"))); 815 changes.push_back(std::make_pair(std::string("A"), std::string("1")));
816 e = base::AlterEnvironment(changes, a2); 816 e = base::AlterEnvironment(changes, a2);
817 EXPECT_EQ(std::string("A=1"), e[0]); 817 EXPECT_EQ(std::string("A=1"), e[0]);
818 EXPECT_TRUE(e[1] == NULL); 818 EXPECT_TRUE(e[1] == NULL);
819 delete[] e; 819 delete[] e;
820 820
821 changes.clear(); 821 changes.clear();
822 changes.push_back(std::make_pair(std::string("A"), std::string(""))); 822 changes.push_back(std::make_pair(std::string("A"), std::string()));
823 e = base::AlterEnvironment(changes, a2); 823 e = base::AlterEnvironment(changes, a2);
824 EXPECT_TRUE(e[0] == NULL); 824 EXPECT_TRUE(e[0] == NULL);
825 delete[] e; 825 delete[] e;
826 } 826 }
827 827
828 TEST_F(ProcessUtilTest, GetAppOutput) { 828 TEST_F(ProcessUtilTest, GetAppOutput) {
829 std::string output; 829 std::string output;
830 830
831 #if defined(OS_ANDROID) 831 #if defined(OS_ANDROID)
832 std::vector<std::string> argv; 832 std::vector<std::string> argv;
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 SetUpInDeathAssert(); 1284 SetUpInDeathAssert();
1285 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {} 1285 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {}
1286 }, ""); 1286 }, "");
1287 } 1287 }
1288 1288
1289 #endif // !ARCH_CPU_64_BITS 1289 #endif // !ARCH_CPU_64_BITS
1290 #endif // OS_MACOSX 1290 #endif // OS_MACOSX
1291 1291
1292 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && 1292 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) &&
1293 // !defined(OS_WIN) && !defined(ADDRESS_SANITIZER) 1293 // !defined(OS_WIN) && !defined(ADDRESS_SANITIZER)
OLDNEW
« no previous file with comments | « base/process_util_linux.cc ('k') | base/string_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698