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

Side by Side Diff: chrome/installer/util/install_util_unittest.cc

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
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 #include <string> 5 #include <string>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 L"\"" + other.value() + L"\"")); 409 L"\"" + other.value() + L"\""));
410 // Paths match exactly. 410 // Paths match exactly.
411 EXPECT_TRUE(InstallUtil::ProgramCompare(expect).Evaluate( 411 EXPECT_TRUE(InstallUtil::ProgramCompare(expect).Evaluate(
412 L"\"" + expect.value() + L"\"")); 412 L"\"" + expect.value() + L"\""));
413 // Paths differ by case. 413 // Paths differ by case.
414 EXPECT_TRUE(InstallUtil::ProgramCompare(expect).Evaluate( 414 EXPECT_TRUE(InstallUtil::ProgramCompare(expect).Evaluate(
415 L"\"" + expect_upcase.value() + L"\"")); 415 L"\"" + expect_upcase.value() + L"\""));
416 416
417 // Tests where the expected file exists. 417 // Tests where the expected file exists.
418 static const char data[] = "data"; 418 static const char data[] = "data";
419 ASSERT_TRUE(file_util::CreateDirectory(some_long_dir)); 419 ASSERT_TRUE(base::CreateDirectory(some_long_dir));
420 ASSERT_NE(-1, file_util::WriteFile(expect, data, arraysize(data) - 1)); 420 ASSERT_NE(-1, file_util::WriteFile(expect, data, arraysize(data) - 1));
421 // Paths don't match. 421 // Paths don't match.
422 EXPECT_FALSE(InstallUtil::ProgramCompare(expect).Evaluate( 422 EXPECT_FALSE(InstallUtil::ProgramCompare(expect).Evaluate(
423 L"\"" + other.value() + L"\"")); 423 L"\"" + other.value() + L"\""));
424 // Paths match exactly. 424 // Paths match exactly.
425 EXPECT_TRUE(InstallUtil::ProgramCompare(expect).Evaluate( 425 EXPECT_TRUE(InstallUtil::ProgramCompare(expect).Evaluate(
426 L"\"" + expect.value() + L"\"")); 426 L"\"" + expect.value() + L"\""));
427 // Paths differ by case. 427 // Paths differ by case.
428 EXPECT_TRUE(InstallUtil::ProgramCompare(expect).Evaluate( 428 EXPECT_TRUE(InstallUtil::ProgramCompare(expect).Evaluate(
429 L"\"" + expect_upcase.value() + L"\"")); 429 L"\"" + expect_upcase.value() + L"\""));
430 430
431 // Test where strings don't match, but the same file is indicated. 431 // Test where strings don't match, but the same file is indicated.
432 std::wstring short_expect; 432 std::wstring short_expect;
433 DWORD short_len = GetShortPathName(expect.value().c_str(), 433 DWORD short_len = GetShortPathName(expect.value().c_str(),
434 WriteInto(&short_expect, MAX_PATH), 434 WriteInto(&short_expect, MAX_PATH),
435 MAX_PATH); 435 MAX_PATH);
436 ASSERT_NE(static_cast<DWORD>(0), short_len); 436 ASSERT_NE(static_cast<DWORD>(0), short_len);
437 ASSERT_GT(static_cast<DWORD>(MAX_PATH), short_len); 437 ASSERT_GT(static_cast<DWORD>(MAX_PATH), short_len);
438 short_expect.resize(short_len); 438 short_expect.resize(short_len);
439 ASSERT_FALSE(base::FilePath::CompareEqualIgnoreCase(expect.value(), 439 ASSERT_FALSE(base::FilePath::CompareEqualIgnoreCase(expect.value(),
440 short_expect)); 440 short_expect));
441 EXPECT_TRUE(InstallUtil::ProgramCompare(expect).Evaluate( 441 EXPECT_TRUE(InstallUtil::ProgramCompare(expect).Evaluate(
442 L"\"" + short_expect + L"\"")); 442 L"\"" + short_expect + L"\""));
443 } 443 }
OLDNEW
« no previous file with comments | « chrome/installer/util/duplicate_tree_detector_unittest.cc ('k') | chrome/installer/util/installer_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698