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

Side by Side Diff: chrome/browser/ui/webui/settings/metrics_reporting_handler_unittest.cc

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years 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 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 EXPECT_CALL(provider_, IsInitializationComplete(testing::_)).WillRepeatedly( 44 EXPECT_CALL(provider_, IsInitializationComplete(testing::_)).WillRepeatedly(
45 testing::Return(true)); 45 testing::Return(true));
46 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); 46 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
47 } 47 }
48 48
49 void SetUp() override { 49 void SetUp() override {
50 ASSERT_EQ(local_state(), g_browser_process->local_state()); 50 ASSERT_EQ(local_state(), g_browser_process->local_state());
51 EXPECT_TRUE(test_web_ui()->call_data().empty()); 51 EXPECT_TRUE(test_web_ui()->call_data().empty());
52 52
53 base::ListValue args; 53 base::ListValue args;
54 args.Append(base::MakeUnique<base::FundamentalValue>(1)); 54 args.Append(base::MakeUnique<base::Value>(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 // For crbug.com/637068 which only run on official bots with no try jobs. 64 // For crbug.com/637068 which only run on official bots with no try jobs.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 metrics::prefs::kMetricsReportingEnabled, 100 metrics::prefs::kMetricsReportingEnabled,
101 !local_state()->GetBoolean(metrics::prefs::kMetricsReportingEnabled)); 101 !local_state()->GetBoolean(metrics::prefs::kMetricsReportingEnabled));
102 EXPECT_TRUE(test_web_ui()->call_data().empty()); 102 EXPECT_TRUE(test_web_ui()->call_data().empty());
103 } 103 }
104 104
105 TEST_F(MetricsReportingHandlerTest, PolicyChangesNotifyPage) { 105 TEST_F(MetricsReportingHandlerTest, PolicyChangesNotifyPage) {
106 // Change the policy, check that the page was notified. 106 // Change the policy, check that the page was notified.
107 map()->Set(policy::key::kMetricsReportingEnabled, 107 map()->Set(policy::key::kMetricsReportingEnabled,
108 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, 108 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
109 policy::POLICY_SOURCE_CLOUD, 109 policy::POLICY_SOURCE_CLOUD,
110 base::MakeUnique<base::FundamentalValue>(true), nullptr); 110 base::MakeUnique<base::Value>(true), nullptr);
111 provider()->UpdateChromePolicy(*map()); 111 provider()->UpdateChromePolicy(*map());
112 EXPECT_EQ(1u, test_web_ui()->call_data().size()); 112 EXPECT_EQ(1u, test_web_ui()->call_data().size());
113 113
114 test_web_ui()->ClearTrackedCalls(); 114 test_web_ui()->ClearTrackedCalls();
115 handler()->DisallowJavascript(); 115 handler()->DisallowJavascript();
116 116
117 // Policies changing while JavaScript is disabled shouldn't notify the page. 117 // Policies changing while JavaScript is disabled shouldn't notify the page.
118 map()->Set(policy::key::kMetricsReportingEnabled, 118 map()->Set(policy::key::kMetricsReportingEnabled,
119 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, 119 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
120 policy::POLICY_SOURCE_CLOUD, 120 policy::POLICY_SOURCE_CLOUD,
121 base::MakeUnique<base::FundamentalValue>(false), nullptr); 121 base::MakeUnique<base::Value>(false), nullptr);
122 provider()->UpdateChromePolicy(*map()); 122 provider()->UpdateChromePolicy(*map());
123 EXPECT_TRUE(test_web_ui()->call_data().empty()); 123 EXPECT_TRUE(test_web_ui()->call_data().empty());
124 } 124 }
125 125
126 } // namespace settings 126 } // namespace settings
127 127
128 #endif // defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) 128 #endif // defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/font_handler.cc ('k') | chrome/browser/ui/webui/settings/profile_info_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698