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

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

Issue 7601006: GTTF: Use a fresh TestingBrowserProcess for each test, part #5 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | 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/file_util.h" 6 #include "base/file_util.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "chrome/browser/policy/cloud_policy_controller.h" 11 #include "chrome/browser/policy/cloud_policy_controller.h"
12 #include "chrome/browser/policy/cloud_policy_data_store.h" 12 #include "chrome/browser/policy/cloud_policy_data_store.h"
13 #include "chrome/browser/policy/device_management_backend.h" 13 #include "chrome/browser/policy/device_management_backend.h"
14 #include "chrome/browser/policy/device_management_backend_mock.h" 14 #include "chrome/browser/policy/device_management_backend_mock.h"
15 #include "chrome/browser/policy/device_management_service.h" 15 #include "chrome/browser/policy/device_management_service.h"
16 #include "chrome/browser/policy/device_token_fetcher.h" 16 #include "chrome/browser/policy/device_token_fetcher.h"
17 #include "chrome/browser/policy/enterprise_metrics.h" 17 #include "chrome/browser/policy/enterprise_metrics.h"
18 #include "chrome/browser/policy/mock_cloud_policy_data_store.h" 18 #include "chrome/browser/policy/mock_cloud_policy_data_store.h"
19 #include "chrome/browser/policy/mock_device_management_service.h" 19 #include "chrome/browser/policy/mock_device_management_service.h"
20 #include "chrome/browser/policy/policy_notifier.h" 20 #include "chrome/browser/policy/policy_notifier.h"
21 #include "chrome/browser/policy/proto/device_management_backend.pb.h" 21 #include "chrome/browser/policy/proto/device_management_backend.pb.h"
22 #include "chrome/browser/policy/proto/device_management_local.pb.h" 22 #include "chrome/browser/policy/proto/device_management_local.pb.h"
23 #include "chrome/browser/policy/user_policy_cache.h" 23 #include "chrome/browser/policy/user_policy_cache.h"
24 #include "chrome/browser/policy/user_policy_token_cache.h" 24 #include "chrome/browser/policy/user_policy_token_cache.h"
25 #include "chrome/test/testing_browser_process_test.h"
25 #include "content/browser/browser_thread.h" 26 #include "content/browser/browser_thread.h"
26 #include "net/url_request/url_request_status.h" 27 #include "net/url_request/url_request_status.h"
27 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
28 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
29 30
30 #if defined(OS_CHROMEOS) 31 #if defined(OS_CHROMEOS)
31 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" 32 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h"
32 #include "chrome/browser/chromeos/login/mock_signed_settings_helper.h" 33 #include "chrome/browser/chromeos/login/mock_signed_settings_helper.h"
33 #include "chrome/browser/chromeos/login/signed_settings.h" 34 #include "chrome/browser/chromeos/login/signed_settings.h"
34 #include "chrome/browser/policy/device_policy_cache.h" 35 #include "chrome/browser/policy/device_policy_cache.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 }; 107 };
107 108
108 } // namespace 109 } // namespace
109 110
110 // This derives from testing::Test and not from InProcessBrowserTest and is 111 // This derives from testing::Test and not from InProcessBrowserTest and is
111 // linked with browser_tests. The reason is that these are just unit tests, but 112 // linked with browser_tests. The reason is that these are just unit tests, but
112 // due to the static initialization of the UMA counters they have to run each 113 // due to the static initialization of the UMA counters they have to run each
113 // in its own process to make sure the counters are not initialized before the 114 // in its own process to make sure the counters are not initialized before the
114 // test runs, and that the StatisticsRecorder instance created for the test 115 // test runs, and that the StatisticsRecorder instance created for the test
115 // doesn't interfere with counters in other tests. 116 // doesn't interfere with counters in other tests.
116 class EnterpriseMetricsTest : public testing::Test { 117 class EnterpriseMetricsTest : public TestingBrowserProcessTest {
117 public: 118 public:
118 EnterpriseMetricsTest() 119 EnterpriseMetricsTest()
119 : ui_thread_(BrowserThread::UI, &loop_), 120 : ui_thread_(BrowserThread::UI, &loop_),
120 file_thread_(BrowserThread::FILE, &loop_) { 121 file_thread_(BrowserThread::FILE, &loop_) {
121 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); 122 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir());
122 } 123 }
123 124
124 void SetMetricName(const std::string& metric_name) { 125 void SetMetricName(const std::string& metric_name) {
125 metric_name_ = metric_name; 126 metric_name_ = metric_name;
126 if (metric_name == kMetricToken) { 127 if (metric_name == kMetricToken) {
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 helper.CompleteRetrieve(chromeos::SignedSettings::NOT_FOUND); 841 helper.CompleteRetrieve(chromeos::SignedSettings::NOT_FOUND);
841 helper.SetData("\xff"); 842 helper.SetData("\xff");
842 helper.SetPolicy(); 843 helper.SetPolicy();
843 ExpectSample(kMetricPolicyFetchInvalidPolicy); 844 ExpectSample(kMetricPolicyFetchInvalidPolicy);
844 EXPECT_TRUE(CheckSamples()); 845 EXPECT_TRUE(CheckSamples());
845 } 846 }
846 847
847 #endif 848 #endif
848 849
849 } // namespace policy 850 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store_win_unittest.cc ('k') | chrome/browser/profiles/avatar_menu_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698