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

Side by Side Diff: chrome/browser/chromeos/policy/device_quirks_policy_browsertest.cc

Issue 2765703003: Include display names in Quirks URL (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
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"
11 #include "components/quirks/quirks_manager.h" 11 #include "components/quirks/quirks_manager.h"
12 #include "content/public/test/test_utils.h" 12 #include "content/public/test/test_utils.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace chromeos { 15 namespace chromeos {
16 16
17 const int64_t kProductId = 0x0000aaaa; 17 const int64_t kProductId = 0x0000aaaa;
18 const char kDisplayName[] = "FakeDisplay";
18 const char kFakeIccData[] = {0x00, 0x00, 0x08, 0x90, 0x20, 0x20, 19 const char kFakeIccData[] = {0x00, 0x00, 0x08, 0x90, 0x20, 0x20,
19 0x20, 0x20, 0x02, 0x10, 0x00, 0x00}; 20 0x20, 0x20, 0x02, 0x10, 0x00, 0x00};
20 21
21 class DeviceQuirksPolicyTest : public policy::DevicePolicyCrosBrowserTest { 22 class DeviceQuirksPolicyTest : public policy::DevicePolicyCrosBrowserTest {
22 public: 23 public:
23 DeviceQuirksPolicyTest() {} 24 DeviceQuirksPolicyTest() {}
24 25
25 void SetUpInProcessBrowserTestFixture() override { 26 void SetUpInProcessBrowserTestFixture() override {
26 InstallOwnerKey(); 27 InstallOwnerKey();
27 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); 28 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Query QuirksManager for icc file, then run msg loop to wait for callback. 60 // Query QuirksManager for icc file, then run msg loop to wait for callback.
60 // This won't actually run a Quirks client: if Quirks is enabled, it will 61 // This won't actually run a Quirks client: if Quirks is enabled, it will
61 // return the icc file in our fake downloads directory; if disabled, it will 62 // return the icc file in our fake downloads directory; if disabled, it will
62 // return before looking there. 63 // return before looking there.
63 bool TestQuirksEnabled() { 64 bool TestQuirksEnabled() {
64 base::RunLoop run_loop; 65 base::RunLoop run_loop;
65 end_message_loop_ = run_loop.QuitClosure(); 66 end_message_loop_ = run_loop.QuitClosure();
66 icc_path_.clear(); 67 icc_path_.clear();
67 68
68 quirks::QuirksManager::Get()->RequestIccProfilePath( 69 quirks::QuirksManager::Get()->RequestIccProfilePath(
69 kProductId, base::Bind(&DeviceQuirksPolicyTest::OnQuirksClientFinished, 70 kProductId, kDisplayName,
70 base::Unretained(this))); 71 base::Bind(&DeviceQuirksPolicyTest::OnQuirksClientFinished,
72 base::Unretained(this)));
71 73
72 run_loop.Run(); 74 run_loop.Run();
73 75
74 // Quirks only returns our fake file if it's enabled. 76 // Quirks only returns our fake file if it's enabled.
75 return !icc_path_.empty(); 77 return !icc_path_.empty();
76 } 78 }
77 79
78 // Callback from RequestIccProfilePath(). 80 // Callback from RequestIccProfilePath().
79 void OnQuirksClientFinished(const base::FilePath& path, bool downloaded) { 81 void OnQuirksClientFinished(const base::FilePath& path, bool downloaded) {
80 ASSERT_FALSE(downloaded); 82 ASSERT_FALSE(downloaded);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 quirks_download_enabled = true; 133 quirks_download_enabled = true;
132 EXPECT_TRUE(CrosSettings::Get()->GetBoolean(kDeviceQuirksDownloadEnabled, 134 EXPECT_TRUE(CrosSettings::Get()->GetBoolean(kDeviceQuirksDownloadEnabled,
133 &quirks_download_enabled)); 135 &quirks_download_enabled));
134 EXPECT_FALSE(quirks_download_enabled); 136 EXPECT_FALSE(quirks_download_enabled);
135 137
136 // With policy disabled, Quirks should abort and not find the fake icc file. 138 // With policy disabled, Quirks should abort and not find the fake icc file.
137 EXPECT_FALSE(TestQuirksEnabled()); 139 EXPECT_FALSE(TestQuirksEnabled());
138 } 140 }
139 141
140 } // namespace chromeos 142 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/display/quirks_browsertest.cc ('k') | components/quirks/quirks_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698