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

Side by Side Diff: chrome/browser/policy/enterprise_metrics_enrollment_browsertest.cc

Issue 8436002: [cros] Remove Views implementation for login/OOBE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen. h" 8 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen. h"
9 #include "chrome/browser/chromeos/login/wizard_controller.h" 9 #include "chrome/browser/chromeos/login/wizard_controller.h"
10 #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h" 10 #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h"
11 #include "chrome/browser/policy/cloud_policy_subsystem.h" 11 #include "chrome/browser/policy/cloud_policy_subsystem.h"
12 #include "chrome/browser/policy/enterprise_metrics.h" 12 #include "chrome/browser/policy/enterprise_metrics.h"
13 #include "chrome/common/net/gaia/gaia_constants.h" 13 #include "chrome/common/net/gaia/gaia_constants.h"
14 #include "chrome/common/net/gaia/google_service_auth_error.h" 14 #include "chrome/common/net/gaia/google_service_auth_error.h"
15 #include "content/browser/plugin_service.h"
16 #include "content/public/browser/browser_thread.h"
15 #include "content/test/test_url_fetcher_factory.h" 17 #include "content/test/test_url_fetcher_factory.h"
16 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
17 19
18 namespace chromeos { 20 namespace chromeos {
19 21
20 namespace { 22 namespace {
21 23
22 void assert_handler(const std::string& str) { 24 void assert_handler(const std::string& str) {
23 LOG(INFO) << "Previous failure was expected, ignoring."; 25 LOG(INFO) << "Previous failure was expected, ignoring.";
24 } 26 }
25 27
28 void QuitMessageLoop() {
29 MessageLoop::current()->Quit();
30 }
31
32 void OnGetPluginsCallback(const std::vector<webkit::WebPluginInfo>&) {
33 content::BrowserThread::PostTask(content::BrowserThread::UI,
34 FROM_HERE,
35 base::Bind(&QuitMessageLoop));
36 }
37
26 } // namespace 38 } // namespace
27 39
28 class EnterpriseMetricsEnrollmentTest : public WizardInProcessBrowserTest { 40 class EnterpriseMetricsEnrollmentTest : public WizardInProcessBrowserTest {
29 protected: 41 protected:
30 EnterpriseMetricsEnrollmentTest() 42 EnterpriseMetricsEnrollmentTest()
31 : WizardInProcessBrowserTest( 43 : WizardInProcessBrowserTest(
32 WizardController::kEnterpriseEnrollmentScreenName) {} 44 WizardController::kEnterpriseEnrollmentScreenName) {}
33 45
34 virtual void SetUpOnMainThread() OVERRIDE { 46 virtual void SetUpOnMainThread() OVERRIDE {
35 WizardInProcessBrowserTest::SetUpOnMainThread(); 47 WizardInProcessBrowserTest::SetUpOnMainThread();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 screen_->OnPolicyStateChanged( 153 screen_->OnPolicyStateChanged(
142 policy::CloudPolicySubsystem::UNENROLLED, 154 policy::CloudPolicySubsystem::UNENROLLED,
143 policy::CloudPolicySubsystem::BAD_SERIAL_NUMBER); 155 policy::CloudPolicySubsystem::BAD_SERIAL_NUMBER);
144 CheckSample(policy::kMetricEnrollmentInvalidSerialNumber); 156 CheckSample(policy::kMetricEnrollmentInvalidSerialNumber);
145 } 157 }
146 158
147 IN_PROC_BROWSER_TEST_F(EnterpriseMetricsEnrollmentTest, EnrollmentOK) { 159 IN_PROC_BROWSER_TEST_F(EnterpriseMetricsEnrollmentTest, EnrollmentOK) {
148 screen_->OnPolicyStateChanged(policy::CloudPolicySubsystem::SUCCESS, 160 screen_->OnPolicyStateChanged(policy::CloudPolicySubsystem::SUCCESS,
149 policy::CloudPolicySubsystem::NO_DETAILS); 161 policy::CloudPolicySubsystem::NO_DETAILS);
150 CheckSample(policy::kMetricEnrollmentOK); 162 CheckSample(policy::kMetricEnrollmentOK);
163
164 // The PluginService might be trying to retrieve information from the
165 // plugin process. Wait until it completes before shutting down.
166 //
167 // During tests the channel to the plugin process may fail to open, and
168 // PluginDataRemover::OnError logs a LOG(DFATAL). The ExpectNOTREACHED here
169 // Prevents this test failing in that case too.
170 ExpectNOTREACHED();
171 PluginService::GetInstance()->GetPlugins(base::Bind(&OnGetPluginsCallback));
172 MessageLoop::current()->Run();
151 } 173 }
152 174
153 IN_PROC_BROWSER_TEST_F(EnterpriseMetricsEnrollmentTest, AuthErrorConnection) { 175 IN_PROC_BROWSER_TEST_F(EnterpriseMetricsEnrollmentTest, AuthErrorConnection) {
154 GoogleServiceAuthError error(GoogleServiceAuthError::CONNECTION_FAILED); 176 GoogleServiceAuthError error(GoogleServiceAuthError::CONNECTION_FAILED);
155 screen_->OnClientLoginFailure(error); 177 screen_->OnClientLoginFailure(error);
156 CheckSample(policy::kMetricEnrollmentNetworkFailed); 178 CheckSample(policy::kMetricEnrollmentNetworkFailed);
157 } 179 }
158 180
159 IN_PROC_BROWSER_TEST_F(EnterpriseMetricsEnrollmentTest, AuthErrorLoginFailed) { 181 IN_PROC_BROWSER_TEST_F(EnterpriseMetricsEnrollmentTest, AuthErrorLoginFailed) {
160 GoogleServiceAuthError error(GoogleServiceAuthError::TWO_FACTOR); 182 GoogleServiceAuthError error(GoogleServiceAuthError::TWO_FACTOR);
161 screen_->OnClientLoginFailure(error); 183 screen_->OnClientLoginFailure(error);
162 CheckSample(policy::kMetricEnrollmentLoginFailed); 184 CheckSample(policy::kMetricEnrollmentLoginFailed);
163 } 185 }
164 186
165 IN_PROC_BROWSER_TEST_F(EnterpriseMetricsEnrollmentTest, AccountDisabled) { 187 IN_PROC_BROWSER_TEST_F(EnterpriseMetricsEnrollmentTest, AccountDisabled) {
166 GoogleServiceAuthError error(GoogleServiceAuthError::ACCOUNT_DISABLED); 188 GoogleServiceAuthError error(GoogleServiceAuthError::ACCOUNT_DISABLED);
167 screen_->OnClientLoginFailure(error); 189 screen_->OnClientLoginFailure(error);
168 CheckSample(policy::kMetricEnrollmentNotSupported); 190 CheckSample(policy::kMetricEnrollmentNotSupported);
169 } 191 }
170 192
171 IN_PROC_BROWSER_TEST_F(EnterpriseMetricsEnrollmentTest, AuthErrorUnexpected) { 193 IN_PROC_BROWSER_TEST_F(EnterpriseMetricsEnrollmentTest, AuthErrorUnexpected) {
172 GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED); 194 GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED);
173 screen_->OnClientLoginFailure(error); 195 screen_->OnClientLoginFailure(error);
174 CheckSample(policy::kMetricEnrollmentNetworkFailed); 196 CheckSample(policy::kMetricEnrollmentNetworkFailed);
175 } 197 }
176 198
177 } // namespace chromeos 199 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/network_dropdown_button.cc ('k') | chrome/browser/policy/resources/enrollment.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698