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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 9 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
10 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 10 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 // Create fake icc file. | 48 // Create fake icc file. |
49 path = path.Append(quirks::IdToFileName(kProductId)); | 49 path = path.Append(quirks::IdToFileName(kProductId)); |
50 int bytes_written = | 50 int bytes_written = |
51 base::WriteFile(path, kFakeIccData, sizeof(kFakeIccData)); | 51 base::WriteFile(path, kFakeIccData, sizeof(kFakeIccData)); |
52 ASSERT_EQ(sizeof(kFakeIccData), static_cast<size_t>(bytes_written)); | 52 ASSERT_EQ(sizeof(kFakeIccData), static_cast<size_t>(bytes_written)); |
53 } | 53 } |
54 | 54 |
55 protected: | 55 protected: |
56 void RefreshPolicyAndWaitDeviceSettingsUpdated() { | 56 void RefreshPolicyAndWaitDeviceSettingsUpdated() { |
57 scoped_ptr<CrosSettings::ObserverSubscription> observer = | 57 std::unique_ptr<CrosSettings::ObserverSubscription> observer = |
58 CrosSettings::Get()->AddSettingsObserver( | 58 CrosSettings::Get()->AddSettingsObserver( |
59 kDeviceQuirksDownloadEnabled, | 59 kDeviceQuirksDownloadEnabled, |
60 base::MessageLoop::current()->QuitWhenIdleClosure()); | 60 base::MessageLoop::current()->QuitWhenIdleClosure()); |
61 | 61 |
62 RefreshDevicePolicy(); | 62 RefreshDevicePolicy(); |
63 base::MessageLoop::current()->Run(); | 63 base::MessageLoop::current()->Run(); |
64 } | 64 } |
65 | 65 |
66 // Query QuirksManager for icc file, then run msg loop to wait for callback. | 66 // Query QuirksManager for icc file, then run msg loop to wait for callback. |
67 // This won't actually run a Quirks client: if Quirks is enabled, it will | 67 // This won't actually run a Quirks client: if Quirks is enabled, it will |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 quirks_download_enabled = true; | 138 quirks_download_enabled = true; |
139 EXPECT_TRUE(CrosSettings::Get()->GetBoolean(kDeviceQuirksDownloadEnabled, | 139 EXPECT_TRUE(CrosSettings::Get()->GetBoolean(kDeviceQuirksDownloadEnabled, |
140 &quirks_download_enabled)); | 140 &quirks_download_enabled)); |
141 EXPECT_FALSE(quirks_download_enabled); | 141 EXPECT_FALSE(quirks_download_enabled); |
142 | 142 |
143 // With policy disabled, Quirks should abort and not find the fake icc file. | 143 // With policy disabled, Quirks should abort and not find the fake icc file. |
144 EXPECT_FALSE(TestQuirksEnabled()); | 144 EXPECT_FALSE(TestQuirksEnabled()); |
145 } | 145 } |
146 | 146 |
147 } // namespace chromeos | 147 } // namespace chromeos |
OLD | NEW |