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

Side by Side Diff: chrome/browser/ui/webui/options/preferences_browsertest.cc

Issue 12340111: Introduce //components/user_prefs, use to eliminate c/b/prefs dependency in Autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge of LKGR Created 7 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/webui/options/preferences_browsertest.h" 5 #include "chrome/browser/ui/webui/options/preferences_browsertest.h"
6 6
7 #include <iostream> 7 #include <iostream>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/policy/browser_policy_connector.h" 16 #include "chrome/browser/policy/browser_policy_connector.h"
17 #include "chrome/browser/policy/policy_map.h" 17 #include "chrome/browser/policy/policy_map.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" 20 #include "chrome/browser/ui/tabs/tab_strip_model.h"
21 #include "chrome/common/chrome_notification_types.h" 21 #include "chrome/common/chrome_notification_types.h"
22 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
23 #include "chrome/common/url_constants.h" 23 #include "chrome/common/url_constants.h"
24 #include "chrome/test/base/ui_test_utils.h" 24 #include "chrome/test/base/ui_test_utils.h"
25 #include "components/user_prefs/user_prefs.h"
25 #include "content/public/browser/notification_details.h" 26 #include "content/public/browser/notification_details.h"
26 #include "content/public/browser/notification_source.h" 27 #include "content/public/browser/notification_source.h"
27 #include "content/public/browser/render_view_host.h" 28 #include "content/public/browser/render_view_host.h"
28 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
29 #include "content/public/test/browser_test_utils.h" 30 #include "content/public/test/browser_test_utils.h"
30 #include "googleurl/src/gurl.h" 31 #include "googleurl/src/gurl.h"
31 #include "policy/policy_constants.h" 32 #include "policy/policy_constants.h"
32 #include "testing/gtest/include/gtest/gtest.h" 33 #include "testing/gtest/include/gtest/gtest.h"
33 34
34 #if defined(OS_CHROMEOS) 35 #if defined(OS_CHROMEOS)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // Navigates to the settings page, causing the JavaScript pref handling code to 75 // Navigates to the settings page, causing the JavaScript pref handling code to
75 // load and injects JavaScript testing code. 76 // load and injects JavaScript testing code.
76 void PreferencesBrowserTest::SetUpOnMainThread() { 77 void PreferencesBrowserTest::SetUpOnMainThread() {
77 ui_test_utils::NavigateToURL(browser(), 78 ui_test_utils::NavigateToURL(browser(),
78 GURL(chrome::kChromeUISettingsFrameURL)); 79 GURL(chrome::kChromeUISettingsFrameURL));
79 content::WebContents* web_contents = 80 content::WebContents* web_contents =
80 browser()->tab_strip_model()->GetActiveWebContents(); 81 browser()->tab_strip_model()->GetActiveWebContents();
81 ASSERT_TRUE(web_contents); 82 ASSERT_TRUE(web_contents);
82 render_view_host_ = web_contents->GetRenderViewHost(); 83 render_view_host_ = web_contents->GetRenderViewHost();
83 ASSERT_TRUE(render_view_host_); 84 ASSERT_TRUE(render_view_host_);
84 pref_change_registrar_.Init( 85 pref_change_registrar_.Init(components::UserPrefs::Get(browser()->profile()));
85 PrefServiceFromBrowserContext(browser()->profile()));
86 pref_service_ = browser()->profile()->GetPrefs(); 86 pref_service_ = browser()->profile()->GetPrefs();
87 ASSERT_TRUE(content::ExecuteScript(render_view_host_, 87 ASSERT_TRUE(content::ExecuteScript(render_view_host_,
88 "function TestEnv() {" 88 "function TestEnv() {"
89 " this.sentinelName_ = 'download.prompt_for_download';" 89 " this.sentinelName_ = 'download.prompt_for_download';"
90 " this.prefs_ = [];" 90 " this.prefs_ = [];"
91 " TestEnv.instance_ = this;" 91 " TestEnv.instance_ = this;"
92 "}" 92 "}"
93 "" 93 ""
94 "TestEnv.handleEvent = function(event) {" 94 "TestEnv.handleEvent = function(event) {"
95 " var env = TestEnv.instance_;" 95 " var env = TestEnv.instance_;"
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 // Do not set the Boolean pref. It will toogle automatically. 738 // Do not set the Boolean pref. It will toogle automatically.
739 for (size_t i = 1; i < pref_names_.size(); ++i) 739 for (size_t i = 1; i < pref_names_.size(); ++i)
740 chromeos::proxy_cros_settings_parser::SetProxyPrefValue( 740 chromeos::proxy_cros_settings_parser::SetProxyPrefValue(
741 profile, pref_names_[i], non_default_values_[i]->DeepCopy()); 741 profile, pref_names_[i], non_default_values_[i]->DeepCopy());
742 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); 742 SetupJavaScriptTestEnvironment(pref_names_, &observed_json);
743 VerifyObservedPrefs(observed_json, pref_names_, non_default_values_, 743 VerifyObservedPrefs(observed_json, pref_names_, non_default_values_,
744 "", false, false); 744 "", false, false);
745 } 745 }
746 746
747 #endif 747 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698