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

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

Issue 814123006: Revert of Implemented consumer management unenrollment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dcpm
Patch Set: Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/memory/scoped_ptr.h" 5 #include "base/compiler_specific.h"
6 #include "chrome/browser/browser_process.h" 6 #include "base/logging.h"
7 #include "chrome/browser/browser_process_platform_part.h" 7 #include "base/macros.h"
8 #include "base/message_loop/message_loop.h"
8 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 9 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
9 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" 10 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
10 #include "chrome/test/base/in_process_browser_test.h" 11 #include "chrome/test/base/testing_browser_process.h"
11 #include "components/policy/core/common/cloud/cloud_policy_client.h"
12 #include "components/policy/core/common/cloud/mock_cloud_policy_client.h"
13 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
14 13
15 namespace policy { 14 namespace policy {
15 namespace {
16 16
17 class DeviceCloudPolicyBrowserTest : public InProcessBrowserTest { 17 // A test fixture simulating a browser that is already managed.
18 public: 18 class DeviceCloudPolicyManagedBrowserTest : public DevicePolicyCrosBrowserTest {
19 DeviceCloudPolicyBrowserTest() : mock_client_(new MockCloudPolicyClient) { 19 protected:
20 DeviceCloudPolicyManagedBrowserTest() {}
21
22 virtual void SetUpInProcessBrowserTestFixture() override {
23 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture();
24
25 InstallOwnerKey();
26 MarkAsEnterpriseOwned();
27 RefreshDevicePolicy();
20 } 28 }
21 29
22 MockCloudPolicyClient* mock_client_; 30 private:
31 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagedBrowserTest);
23 }; 32 };
24 33
25 IN_PROC_BROWSER_TEST_F(DeviceCloudPolicyBrowserTest, Initializer) { 34 IN_PROC_BROWSER_TEST_F(DeviceCloudPolicyManagedBrowserTest, NoInitializer) {
26 BrowserPolicyConnectorChromeOS* connector = 35 BrowserPolicyConnectorChromeOS* connector =
27 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 36 g_browser_process->platform_part()->browser_policy_connector_chromeos();
28 // Initializer exists at first. 37 EXPECT_FALSE(connector->GetDeviceCloudPolicyInitializer());
29 EXPECT_TRUE(connector->GetDeviceCloudPolicyInitializer()); 38 }
30 39
31 // Initializer is deleted when the manager connects. 40 // A test fixture simulating a browser that is still unmanaged.
32 connector->GetDeviceCloudPolicyManager()->StartConnection( 41 class DeviceCloudPolicyUnmanagedBrowserTest
33 make_scoped_ptr(mock_client_), 42 : public DevicePolicyCrosBrowserTest {
34 connector->GetInstallAttributes()); 43 protected:
35 EXPECT_FALSE(connector->GetDeviceCloudPolicyInitializer()); 44 DeviceCloudPolicyUnmanagedBrowserTest() {}
36 45
37 // Initializer is restarted when the manager disconnects. 46 virtual void SetUpInProcessBrowserTestFixture() override {
38 connector->GetDeviceCloudPolicyManager()->Disconnect(); 47 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture();
48 }
49
50 private:
51 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyUnmanagedBrowserTest);
52 };
53
54 IN_PROC_BROWSER_TEST_F(DeviceCloudPolicyUnmanagedBrowserTest,
55 StillHasInitializer) {
56 BrowserPolicyConnectorChromeOS* connector =
57 g_browser_process->platform_part()->browser_policy_connector_chromeos();
39 EXPECT_TRUE(connector->GetDeviceCloudPolicyInitializer()); 58 EXPECT_TRUE(connector->GetDeviceCloudPolicyInitializer());
40 } 59 }
41 60
61 } // namespace
42 } // namespace policy 62 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698