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

Unified Diff: chrome/browser/chromeos/file_manager/path_util_unittest.cc

Issue 2907493002: ChromeOS: Per-user time zone: refactor tests first. (Closed)
Patch Set: Move more code from dependent CL here. 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
Index: chrome/browser/chromeos/file_manager/path_util_unittest.cc
diff --git a/chrome/browser/chromeos/file_manager/path_util_unittest.cc b/chrome/browser/chromeos/file_manager/path_util_unittest.cc
index f7ad12162f5a8ee9a46959d87fc694221b4a1724..dd65977b9ac13e5a9cd99eb2599c4afe355ec8fa 100644
--- a/chrome/browser/chromeos/file_manager/path_util_unittest.cc
+++ b/chrome/browser/chromeos/file_manager/path_util_unittest.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/file_manager/path_util.h"
#include "base/files/file_path.h"
+#include "base/sys_info.h"
#include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
#include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
@@ -20,9 +21,29 @@ namespace file_manager {
namespace util {
namespace {
+const char kLsbRelease[] =
+ "CHROMEOS_RELEASE_NAME=Chrome OS\n"
+ "CHROMEOS_RELEASE_VERSION=1.2.3.4\n";
+
+// Sets a valid Chrome OS version info so IsRunningOnChromeOS() returns true.
stevenjb 2017/05/25 21:20:24 This is a bit subtle, can you explain a little why
Alexander Alekseev 2017/05/26 02:18:01 Done. (See below.)
+class ScopedSetRunningOnChromeOS {
+ public:
+ ScopedSetRunningOnChromeOS(const std::string& lsb_release,
+ const base::Time& lsb_release_time) {
+ base::SysInfo::SetChromeOSVersionInfoForTest(lsb_release, lsb_release_time);
+ }
+ ~ScopedSetRunningOnChromeOS() {
+ base::SysInfo::SetChromeOSVersionInfoForTest("", base::Time());
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScopedSetRunningOnChromeOS);
+};
+
TEST(FileManagerPathUtilTest, MultiProfileDownloadsFolderMigration) {
content::TestBrowserThreadBundle thread_bundle;
TestingProfile profile;
+ ScopedSetRunningOnChromeOS fake_release(kLsbRelease, base::Time());
// This looks like "/home/chronos/u-hash/Downloads" in the production
// environment.

Powered by Google App Engine
This is Rietveld 408576698