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/values.h" | 10 #include "base/values.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 args.Append(base::WrapUnique(new base::FundamentalValue(1))); | 54 args.Append(base::WrapUnique(new base::FundamentalValue(1))); |
55 handler()->HandleGetMetricsReporting(&args); | 55 handler()->HandleGetMetricsReporting(&args); |
56 | 56 |
57 EXPECT_TRUE(handler()->IsJavascriptAllowed()); | 57 EXPECT_TRUE(handler()->IsJavascriptAllowed()); |
58 EXPECT_EQ(1u, test_web_ui()->call_data().size()); | 58 EXPECT_EQ(1u, test_web_ui()->call_data().size()); |
59 | 59 |
60 test_web_ui()->ClearTrackedCalls(); | 60 test_web_ui()->ClearTrackedCalls(); |
61 } | 61 } |
62 | 62 |
63 void TearDown() override { | 63 void TearDown() override { |
64 base::RunLoop().RunUntilIdle(); | |
64 handler_.reset(); | 65 handler_.reset(); |
66 base::RunLoop().RunUntilIdle(); | |
67 local_state_.reset(); | |
68 base::RunLoop().RunUntilIdle(); | |
dschuyler
2016/08/19 21:14:04
imo, this begs for a comment about what
the goal i
Dan Beam
2016/08/24 19:17:56
Done.
| |
65 } | 69 } |
66 | 70 |
67 PrefService* local_state() { return local_state_->Get(); } | 71 PrefService* local_state() { return local_state_->Get(); } |
68 TestingMetricsReportingHandler* handler() { return handler_.get(); } | 72 TestingMetricsReportingHandler* handler() { return handler_.get(); } |
69 content::TestWebUI* test_web_ui() { return &test_web_ui_; } | 73 content::TestWebUI* test_web_ui() { return &test_web_ui_; } |
70 policy::PolicyMap* map() { return &map_; } | 74 policy::PolicyMap* map() { return &map_; } |
71 policy::MockConfigurationPolicyProvider* provider() { return &provider_; } | 75 policy::MockConfigurationPolicyProvider* provider() { return &provider_; } |
72 | 76 |
73 private: | 77 private: |
74 content::TestBrowserThreadBundle thread_bundle_; | 78 content::TestBrowserThreadBundle thread_bundle_; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 policy::POLICY_SOURCE_CLOUD, | 122 policy::POLICY_SOURCE_CLOUD, |
119 base::WrapUnique(new base::FundamentalValue(false)), | 123 base::WrapUnique(new base::FundamentalValue(false)), |
120 nullptr); | 124 nullptr); |
121 provider()->UpdateChromePolicy(*map()); | 125 provider()->UpdateChromePolicy(*map()); |
122 EXPECT_TRUE(test_web_ui()->call_data().empty()); | 126 EXPECT_TRUE(test_web_ui()->call_data().empty()); |
123 } | 127 } |
124 | 128 |
125 } // namespace settings | 129 } // namespace settings |
126 | 130 |
127 #endif // defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) | 131 #endif // defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) |
OLD | NEW |