| OLD | NEW |
| 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 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) | 5 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) |
| 6 | 6 |
| 7 #include "chrome/browser/ui/webui/settings/metrics_reporting_handler.h" | 7 #include "chrome/browser/ui/webui/settings/metrics_reporting_handler.h" |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 class TestingMetricsReportingHandler : public MetricsReportingHandler { | 28 class TestingMetricsReportingHandler : public MetricsReportingHandler { |
| 29 public: | 29 public: |
| 30 using MetricsReportingHandler::set_web_ui; | 30 using MetricsReportingHandler::set_web_ui; |
| 31 using MetricsReportingHandler::HandleGetMetricsReporting; | 31 using MetricsReportingHandler::HandleGetMetricsReporting; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 class MetricsReportingHandlerTest : public testing::Test { | 34 class MetricsReportingHandlerTest : public testing::Test { |
| 35 public: | 35 public: |
| 36 MetricsReportingHandlerTest() { | 36 MetricsReportingHandlerTest() { |
| 37 // Local state must be set up before |handler_|. | 37 // Local state must be set up before |handler_|. |
| 38 TestingBrowserProcess::CreateInstance(); | |
| 39 local_state_.reset(new ScopedTestingLocalState( | 38 local_state_.reset(new ScopedTestingLocalState( |
| 40 TestingBrowserProcess::GetGlobal())); | 39 TestingBrowserProcess::GetGlobal())); |
| 41 | 40 |
| 42 handler_.reset(new TestingMetricsReportingHandler); | 41 handler_.reset(new TestingMetricsReportingHandler); |
| 43 handler_->set_web_ui(&test_web_ui_); | 42 handler_->set_web_ui(&test_web_ui_); |
| 44 | 43 |
| 45 EXPECT_CALL(provider_, IsInitializationComplete(testing::_)).WillRepeatedly( | 44 EXPECT_CALL(provider_, IsInitializationComplete(testing::_)).WillRepeatedly( |
| 46 testing::Return(true)); | 45 testing::Return(true)); |
| 47 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); | 46 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
| 48 } | 47 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 policy::POLICY_SOURCE_CLOUD, | 123 policy::POLICY_SOURCE_CLOUD, |
| 125 base::WrapUnique(new base::FundamentalValue(false)), | 124 base::WrapUnique(new base::FundamentalValue(false)), |
| 126 nullptr); | 125 nullptr); |
| 127 provider()->UpdateChromePolicy(*map()); | 126 provider()->UpdateChromePolicy(*map()); |
| 128 EXPECT_TRUE(test_web_ui()->call_data().empty()); | 127 EXPECT_TRUE(test_web_ui()->call_data().empty()); |
| 129 } | 128 } |
| 130 | 129 |
| 131 } // namespace settings | 130 } // namespace settings |
| 132 | 131 |
| 133 #endif // defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) | 132 #endif // defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) |
| OLD | NEW |