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

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

Issue 2801113002: Make login screen apps enabled by default (Closed)
Patch Set: Rebase 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/chrome_process_manager_delegate.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // Intentionally not using the |chromeos::ProfileHelper::GetSigninProfile| 138 // Intentionally not using the |chromeos::ProfileHelper::GetSigninProfile|
139 // method here, as it performs the lazy construction of the profile, while for 139 // method here, as it performs the lazy construction of the profile, while for
140 // the testing purposes it's better to assert that it has been created before. 140 // the testing purposes it's better to assert that it has been created before.
141 Profile* const profile = 141 Profile* const profile =
142 g_browser_process->profile_manager()->GetProfileByPath( 142 g_browser_process->profile_manager()->GetProfileByPath(
143 chromeos::ProfileHelper::GetSigninProfileDir()); 143 chromeos::ProfileHelper::GetSigninProfileDir());
144 DCHECK(profile); 144 DCHECK(profile);
145 return profile; 145 return profile;
146 } 146 }
147 147
148 // Tests for the sign-in profile apps being enabled via the command line flag.
149 // TODO(emaxx): Remove this smoke test once it's investigated whether just
150 // specifying this command line flag leads to tests being timed out.
151 class SigninProfileAppsEnabledViaCommandLineTest : public InProcessBrowserTest {
152 protected:
153 SigninProfileAppsEnabledViaCommandLineTest() {}
154
155 void SetUpCommandLine(base::CommandLine* command_line) override {
156 InProcessBrowserTest::SetUpCommandLine(command_line);
157 command_line->AppendSwitch(switches::kEnableLoginScreenApps);
158 }
159
160 private:
161 DISALLOW_COPY_AND_ASSIGN(SigninProfileAppsEnabledViaCommandLineTest);
162 };
163
164 } // namespace 148 } // namespace
165 149
166 IN_PROC_BROWSER_TEST_F(SigninProfileAppsEnabledViaCommandLineTest,
167 NoExtensions) {
168 EXPECT_TRUE(extensions::ExtensionSystem::Get(GetProfile())
169 ->extension_service()
170 ->extensions_enabled());
171 }
172
173 namespace { 150 namespace {
174 151
175 // Base class for testing sign-in profile apps that are installed via the device 152 // Base class for testing sign-in profile apps that are installed via the device
176 // policy. 153 // policy.
177 class SigninProfileAppsPolicyTestBase : public DevicePolicyCrosBrowserTest { 154 class SigninProfileAppsPolicyTestBase : public DevicePolicyCrosBrowserTest {
178 protected: 155 protected:
179 explicit SigninProfileAppsPolicyTestBase(version_info::Channel channel) 156 explicit SigninProfileAppsPolicyTestBase(version_info::Channel channel)
180 : channel_(channel), scoped_current_channel_(channel) {} 157 : channel_(channel), scoped_current_channel_(channel) {}
181 158
182 void SetUpCommandLine(base::CommandLine* command_line) override { 159 void SetUpCommandLine(base::CommandLine* command_line) override {
183 DevicePolicyCrosBrowserTest::SetUpCommandLine(command_line); 160 DevicePolicyCrosBrowserTest::SetUpCommandLine(command_line);
184 command_line->AppendSwitch(chromeos::switches::kLoginManager); 161 command_line->AppendSwitch(chromeos::switches::kLoginManager);
185 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); 162 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests);
186 command_line->AppendSwitch(switches::kEnableLoginScreenApps);
187 } 163 }
188 164
189 void SetUpInProcessBrowserTestFixture() override { 165 void SetUpInProcessBrowserTestFixture() override {
190 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); 166 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture();
191 InstallOwnerKey(); 167 InstallOwnerKey();
192 MarkAsEnterpriseOwned(); 168 MarkAsEnterpriseOwned();
193 } 169 }
194 170
195 void SetUpOnMainThread() override { 171 void SetUpOnMainThread() override {
196 EnableUrlRequestMocks(); 172 EnableUrlRequestMocks();
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 protected: 294 protected:
319 SigninProfileAppsPolicyTest() 295 SigninProfileAppsPolicyTest()
320 : SigninProfileAppsPolicyTestBase(version_info::Channel::UNKNOWN) {} 296 : SigninProfileAppsPolicyTestBase(version_info::Channel::UNKNOWN) {}
321 297
322 private: 298 private:
323 DISALLOW_COPY_AND_ASSIGN(SigninProfileAppsPolicyTest); 299 DISALLOW_COPY_AND_ASSIGN(SigninProfileAppsPolicyTest);
324 }; 300 };
325 301
326 } // namespace 302 } // namespace
327 303
304 // Tests that the extension system enables non-standard extensions in the
305 // sign-in profile.
306 IN_PROC_BROWSER_TEST_F(SigninProfileAppsPolicyTest, ExtensionsEnabled) {
307 EXPECT_TRUE(extensions::ExtensionSystem::Get(GetProfile())
308 ->extension_service()
309 ->extensions_enabled());
310 }
311
328 // Tests that a background page is created for the installed sign-in profile 312 // Tests that a background page is created for the installed sign-in profile
329 // app. 313 // app.
330 IN_PROC_BROWSER_TEST_F(SigninProfileAppsPolicyTest, BackgroundPage) { 314 IN_PROC_BROWSER_TEST_F(SigninProfileAppsPolicyTest, BackgroundPage) {
331 ExtensionBackgroundPageReadyObserver page_observer(kTrivialAppId); 315 ExtensionBackgroundPageReadyObserver page_observer(kTrivialAppId);
332 AddExtensionForForceInstallation( 316 AddExtensionForForceInstallation(
333 kTrivialAppId, base::FilePath(kTrivialAppUpdateManifestPath)); 317 kTrivialAppId, base::FilePath(kTrivialAppUpdateManifestPath));
334 page_observer.Wait(); 318 page_observer.Wait();
335 } 319 }
336 320
337 // Tests installation of multiple sign-in profile apps. 321 // Tests installation of multiple sign-in profile apps.
338 IN_PROC_BROWSER_TEST_F(SigninProfileAppsPolicyTest, MultipleApps) { 322 IN_PROC_BROWSER_TEST_F(SigninProfileAppsPolicyTest, MultipleApps) {
339 extensions::TestExtensionRegistryObserver registry_observer1( 323 extensions::TestExtensionRegistryObserver registry_observer1(
340 extensions::ExtensionRegistry::Get(GetProfile()), kTestAppId); 324 extensions::ExtensionRegistry::Get(GetProfile()), kTestAppId);
341 extensions::TestExtensionRegistryObserver registry_observer2( 325 extensions::TestExtensionRegistryObserver registry_observer2(
342 extensions::ExtensionRegistry::Get(GetProfile()), kTrivialAppId); 326 extensions::ExtensionRegistry::Get(GetProfile()), kTrivialAppId);
343 327
344 AddExtensionForForceInstallation(kTestAppId, 328 AddExtensionForForceInstallation(kTestAppId,
345 base::FilePath(kTestAppUpdateManifestPath)); 329 base::FilePath(kTestAppUpdateManifestPath));
346 AddExtensionForForceInstallation( 330 AddExtensionForForceInstallation(
347 kTrivialAppId, base::FilePath(kTrivialAppUpdateManifestPath)); 331 kTrivialAppId, base::FilePath(kTrivialAppUpdateManifestPath));
348 332
349 registry_observer1.WaitForExtensionLoaded(); 333 registry_observer1.WaitForExtensionLoaded();
350 registry_observer2.WaitForExtensionLoaded(); 334 registry_observer2.WaitForExtensionLoaded();
351 } 335 }
352 336
353 } // namespace policy 337 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/chrome_process_manager_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698