| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/files/file_util.h" | 5 #include "base/files/file_util.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 8 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
| 9 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 9 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
| 10 #include "chrome/browser/chromeos/settings/cros_settings.h" | 10 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 void SetUpInProcessBrowserTestFixture() override { | 25 void SetUpInProcessBrowserTestFixture() override { |
| 26 InstallOwnerKey(); | 26 InstallOwnerKey(); |
| 27 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); | 27 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void SetUpOnMainThread() override { | 30 void SetUpOnMainThread() override { |
| 31 // NOTE: QuirksManager::Initialize() isn't necessary here, since it'll be | 31 // NOTE: QuirksManager::Initialize() isn't necessary here, since it'll be |
| 32 // called in ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun(). | 32 // called in ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun(). |
| 33 | 33 |
| 34 // Create display_profiles subdirectory under temp profile directory. | 34 // Create display_profiles subdirectory under temp profile directory. |
| 35 base::FilePath path = quirks::QuirksManager::Get() | 35 base::FilePath path = |
| 36 ->delegate() | 36 quirks::QuirksManager::Get()->delegate()->GetDisplayProfileDirectory(); |
| 37 ->GetDownloadDisplayProfileDirectory(); | |
| 38 base::File::Error error = base::File::FILE_OK; | 37 base::File::Error error = base::File::FILE_OK; |
| 39 bool created = base::CreateDirectoryAndGetError(path, &error); | 38 bool created = base::CreateDirectoryAndGetError(path, &error); |
| 40 ASSERT_TRUE(created) << error; | 39 ASSERT_TRUE(created) << error; |
| 41 | 40 |
| 42 // Create fake icc file. | 41 // Create fake icc file. |
| 43 path = path.Append(quirks::IdToFileName(kProductId)); | 42 path = path.Append(quirks::IdToFileName(kProductId)); |
| 44 int bytes_written = | 43 int bytes_written = |
| 45 base::WriteFile(path, kFakeIccData, sizeof(kFakeIccData)); | 44 base::WriteFile(path, kFakeIccData, sizeof(kFakeIccData)); |
| 46 ASSERT_EQ(sizeof(kFakeIccData), static_cast<size_t>(bytes_written)); | 45 ASSERT_EQ(sizeof(kFakeIccData), static_cast<size_t>(bytes_written)); |
| 47 } | 46 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 quirks_download_enabled = true; | 131 quirks_download_enabled = true; |
| 133 EXPECT_TRUE(CrosSettings::Get()->GetBoolean(kDeviceQuirksDownloadEnabled, | 132 EXPECT_TRUE(CrosSettings::Get()->GetBoolean(kDeviceQuirksDownloadEnabled, |
| 134 &quirks_download_enabled)); | 133 &quirks_download_enabled)); |
| 135 EXPECT_FALSE(quirks_download_enabled); | 134 EXPECT_FALSE(quirks_download_enabled); |
| 136 | 135 |
| 137 // With policy disabled, Quirks should abort and not find the fake icc file. | 136 // With policy disabled, Quirks should abort and not find the fake icc file. |
| 138 EXPECT_FALSE(TestQuirksEnabled()); | 137 EXPECT_FALSE(TestQuirksEnabled()); |
| 139 } | 138 } |
| 140 | 139 |
| 141 } // namespace chromeos | 140 } // namespace chromeos |
| OLD | NEW |