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

Side by Side Diff: chrome/common/mac/app_mode_chrome_locator_browsertest.mm

Issue 1269773002: Cleanup VersionInfo after componentization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 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
« no previous file with comments | « chrome/common/gcm_desktop_util.cc ('k') | chrome/common/mac/mock_launchd.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 #import "chrome/common/mac/app_mode_chrome_locator.h" 5 #import "chrome/common/mac/app_mode_chrome_locator.h"
6 6
7 #include <CoreFoundation/CoreFoundation.h> 7 #include <CoreFoundation/CoreFoundation.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "chrome/common/chrome_constants.h" 13 #include "chrome/common/chrome_constants.h"
14 #include "chrome/common/chrome_version_info.h" 14 #include "components/version_info/version_info.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace { 17 namespace {
18 18
19 // This needs to be a browser test because it expects to find a Chrome.app 19 // This needs to be a browser test because it expects to find a Chrome.app
20 // bundle in the output directory. 20 // bundle in the output directory.
21 21
22 // Return the path to the Chrome/Chromium app bundle compiled along with the 22 // Return the path to the Chrome/Chromium app bundle compiled along with the
23 // test executable. 23 // test executable.
24 void GetChromeBundlePath(base::FilePath* chrome_bundle) { 24 void GetChromeBundlePath(base::FilePath* chrome_bundle) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 TEST(ChromeLocatorTest, GetChromeBundleInfoWithLatestVersion) { 78 TEST(ChromeLocatorTest, GetChromeBundleInfoWithLatestVersion) {
79 base::FilePath chrome_bundle_path; 79 base::FilePath chrome_bundle_path;
80 GetChromeBundlePath(&chrome_bundle_path); 80 GetChromeBundlePath(&chrome_bundle_path);
81 ASSERT_TRUE(base::DirectoryExists(chrome_bundle_path)); 81 ASSERT_TRUE(base::DirectoryExists(chrome_bundle_path));
82 82
83 base::FilePath executable_path; 83 base::FilePath executable_path;
84 base::FilePath version_path; 84 base::FilePath version_path;
85 base::FilePath framework_path; 85 base::FilePath framework_path;
86 EXPECT_TRUE(app_mode::GetChromeBundleInfo(chrome_bundle_path, 86 EXPECT_TRUE(app_mode::GetChromeBundleInfo(chrome_bundle_path,
87 chrome::VersionInfo().Version(), 87 version_info::GetVersionNumber(),
88 &executable_path, 88 &executable_path,
89 &version_path, 89 &version_path,
90 &framework_path)); 90 &framework_path));
91 EXPECT_TRUE(base::PathExists(executable_path)); 91 EXPECT_TRUE(base::PathExists(executable_path));
92 EXPECT_TRUE(base::DirectoryExists(version_path)); 92 EXPECT_TRUE(base::DirectoryExists(version_path));
93 EXPECT_TRUE(base::PathExists(framework_path)); 93 EXPECT_TRUE(base::PathExists(framework_path));
94 } 94 }
95 95
96 TEST(ChromeLocatorTest, GetChromeBundleInfoWithInvalidVersion) { 96 TEST(ChromeLocatorTest, GetChromeBundleInfoWithInvalidVersion) {
97 base::FilePath chrome_bundle_path; 97 base::FilePath chrome_bundle_path;
(...skipping 16 matching lines...) Expand all
114 114
115 TEST(ChromeLocatorTest, GetChromeBundleInfoWithPreviousVersion) { 115 TEST(ChromeLocatorTest, GetChromeBundleInfoWithPreviousVersion) {
116 base::FilePath chrome_bundle_path; 116 base::FilePath chrome_bundle_path;
117 GetChromeBundlePath(&chrome_bundle_path); 117 GetChromeBundlePath(&chrome_bundle_path);
118 ASSERT_TRUE(base::DirectoryExists(chrome_bundle_path)); 118 ASSERT_TRUE(base::DirectoryExists(chrome_bundle_path));
119 119
120 // Make a symlink that pretends to be a previous version. 120 // Make a symlink that pretends to be a previous version.
121 base::FilePath fake_version_directory = chrome_bundle_path.Append("Contents") 121 base::FilePath fake_version_directory = chrome_bundle_path.Append("Contents")
122 .Append("Versions") 122 .Append("Versions")
123 .Append("previous_version"); 123 .Append("previous_version");
124 EXPECT_TRUE(base::CreateSymbolicLink( 124 EXPECT_TRUE(
125 base::FilePath(chrome::VersionInfo().Version()), fake_version_directory)); 125 base::CreateSymbolicLink(base::FilePath(version_info::GetVersionNumber()),
126 fake_version_directory));
126 127
127 base::FilePath executable_path; 128 base::FilePath executable_path;
128 base::FilePath version_path; 129 base::FilePath version_path;
129 base::FilePath framework_path; 130 base::FilePath framework_path;
130 EXPECT_TRUE(app_mode::GetChromeBundleInfo(chrome_bundle_path, 131 EXPECT_TRUE(app_mode::GetChromeBundleInfo(chrome_bundle_path,
131 std::string("previous_version"), 132 std::string("previous_version"),
132 &executable_path, 133 &executable_path,
133 &version_path, 134 &version_path,
134 &framework_path)); 135 &framework_path));
135 EXPECT_TRUE(base::PathExists(executable_path)); 136 EXPECT_TRUE(base::PathExists(executable_path));
136 EXPECT_TRUE(base::DirectoryExists(version_path)); 137 EXPECT_TRUE(base::DirectoryExists(version_path));
137 EXPECT_TRUE(base::PathExists(framework_path)); 138 EXPECT_TRUE(base::PathExists(framework_path));
138 139
139 base::DeleteFile(fake_version_directory, false); 140 base::DeleteFile(fake_version_directory, false);
140 } 141 }
OLDNEW
« no previous file with comments | « chrome/common/gcm_desktop_util.cc ('k') | chrome/common/mac/mock_launchd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698