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

Side by Side Diff: chrome/browser/sessions/restore_on_startup_policy_handler_unittest.cc

Issue 1350913006: Revert of Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <string> 5 #include <string>
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/prefs/pref_value_map.h" 9 #include "base/prefs/pref_value_map.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/prefs/session_startup_pref.h" 13 #include "chrome/browser/prefs/session_startup_pref.h"
14 #include "chrome/browser/sessions/restore_on_startup_policy_handler.h" 14 #include "chrome/browser/sessions/restore_on_startup_policy_handler.h"
15 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
16 #include "components/policy/core/browser/configuration_policy_handler.h" 16 #include "components/policy/core/browser/configuration_policy_handler.h"
17 #include "components/policy/core/browser/policy_error_map.h" 17 #include "components/policy/core/browser/policy_error_map.h"
18 #include "components/policy/core/common/policy_map.h" 18 #include "components/policy/core/common/policy_map.h"
19 #include "components/policy/core/common/policy_types.h"
20 #include "grit/components_strings.h" 19 #include "grit/components_strings.h"
21 #include "policy/policy_constants.h" 20 #include "policy/policy_constants.h"
22 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
23 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
24 23
25 namespace policy { 24 namespace policy {
26 25
27 class RestoreOnStartupPolicyHandlerTest : public testing::Test { 26 class RestoreOnStartupPolicyHandlerTest : public testing::Test {
28 protected: 27 protected:
29 void SetPolicyValue(const std::string& policy, base::Value* value) { 28 void SetPolicyValue(const std::string& policy, base::Value* value) {
30 policies_.Set( 29 policies_.Set(
31 policy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 30 policy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, value, NULL);
32 value, nullptr);
33 } 31 }
34 bool CheckPolicySettings() { 32 bool CheckPolicySettings() {
35 return handler_.CheckPolicySettings(policies_, &errors_); 33 return handler_.CheckPolicySettings(policies_, &errors_);
36 } 34 }
37 void ApplyPolicySettings() { 35 void ApplyPolicySettings() {
38 handler_.ApplyPolicySettings(policies_, &prefs_); 36 handler_.ApplyPolicySettings(policies_, &prefs_);
39 } 37 }
40 PolicyErrorMap& errors() { return errors_; } 38 PolicyErrorMap& errors() { return errors_; }
41 PrefValueMap& prefs() { return prefs_; } 39 PrefValueMap& prefs() { return prefs_; }
42 40
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 EXPECT_TRUE(prefs().GetValue(prefs::kURLsToRestoreOnStartup, &url_result)); 282 EXPECT_TRUE(prefs().GetValue(prefs::kURLsToRestoreOnStartup, &url_result));
285 base::ListValue* url_list_result; 283 base::ListValue* url_list_result;
286 EXPECT_TRUE(url_result->GetAsList(&url_list_result)); 284 EXPECT_TRUE(url_result->GetAsList(&url_list_result));
287 EXPECT_EQ(1U, url_list_result->GetSize()); 285 EXPECT_EQ(1U, url_list_result->GetSize());
288 std::string expected_url; 286 std::string expected_url;
289 EXPECT_TRUE(url_list_result->GetString(0, &expected_url)); 287 EXPECT_TRUE(url_list_result->GetString(0, &expected_url));
290 EXPECT_EQ(std::string("http://foo.com"), expected_url); 288 EXPECT_EQ(std::string("http://foo.com"), expected_url);
291 } 289 }
292 290
293 } // namespace policy 291 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698