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

Side by Side Diff: chrome/browser/dom_ui/new_tab_ui_uitest.cc

Issue 3051001: Adjust preference sync code to only sync user modifiable preferences. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: separate out the download_manager_unittest.cc fixes Created 10 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/dom_ui/shown_sections_handler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/test/ui/ui_test.h" 5 #include "chrome/test/ui/ui_test.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "chrome/app/chrome_dll_resource.h" 8 #include "chrome/app/chrome_dll_resource.h"
9 #include "chrome/browser/chrome_thread.h" 9 #include "chrome/browser/chrome_thread.h"
10 #include "chrome/browser/dom_ui/new_tab_ui.h" 10 #include "chrome/browser/dom_ui/new_tab_ui.h"
11 #include "chrome/browser/pref_service.h"
12 #include "chrome/browser/pref_value_store.h" 11 #include "chrome/browser/pref_value_store.h"
13 #include "chrome/common/json_pref_store.h" 12 #include "chrome/common/json_pref_store.h"
14 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
15 #include "chrome/test/automation/browser_proxy.h" 14 #include "chrome/test/automation/browser_proxy.h"
16 #include "chrome/test/automation/tab_proxy.h" 15 #include "chrome/test/automation/tab_proxy.h"
17 #include "chrome/test/automation/window_proxy.h" 16 #include "chrome/test/automation/window_proxy.h"
17 #include "chrome/test/testing_pref_service.h"
18 18
19 class NewTabUITest : public UITest { 19 class NewTabUITest : public UITest {
20 public: 20 public:
21 NewTabUITest() { 21 NewTabUITest() {
22 dom_automation_enabled_ = true; 22 dom_automation_enabled_ = true;
23 // Set home page to the empty string so that we can set the home page using 23 // Set home page to the empty string so that we can set the home page using
24 // preferences. 24 // preferences.
25 homepage_ = L""; 25 homepage_ = L"";
26 26
27 // Setup the DEFAULT_THEME profile (has fake history entries). 27 // Setup the DEFAULT_THEME profile (has fake history entries).
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 int thumbnails_count = -1; 68 int thumbnails_count = -1;
69 ASSERT_TRUE(tab->ExecuteAndExtractInt(L"", 69 ASSERT_TRUE(tab->ExecuteAndExtractInt(L"",
70 L"window.domAutomationController.send(" 70 L"window.domAutomationController.send("
71 L"document.getElementsByClassName('thumbnail-container').length)", 71 L"document.getElementsByClassName('thumbnail-container').length)",
72 &thumbnails_count)); 72 &thumbnails_count));
73 EXPECT_GT(thumbnails_count, 0); 73 EXPECT_GT(thumbnails_count, 0);
74 } 74 }
75 75
76 TEST_F(NewTabUITest, UpdateUserPrefsVersion) { 76 TEST_F(NewTabUITest, UpdateUserPrefsVersion) {
77 // PrefService with JSON user-pref file only, no enforced or advised prefs. 77 // PrefService with JSON user-pref file only, no enforced or advised prefs.
78 FilePath user_prefs = FilePath(); 78 scoped_ptr<PrefService> prefs(new TestingPrefService);
79 scoped_ptr<PrefService> prefs(
80 PrefService::CreateUserPrefService(user_prefs));
81 79
82 // Does the migration 80 // Does the migration
83 NewTabUI::RegisterUserPrefs(prefs.get()); 81 NewTabUI::RegisterUserPrefs(prefs.get());
84 82
85 ASSERT_EQ(NewTabUI::current_pref_version(), 83 ASSERT_EQ(NewTabUI::current_pref_version(),
86 prefs->GetInteger(prefs::kNTPPrefVersion)); 84 prefs->GetInteger(prefs::kNTPPrefVersion));
87 85
88 // Reset the version 86 // Reset the version
89 prefs->ClearPref(prefs::kNTPPrefVersion); 87 prefs->ClearPref(prefs::kNTPPrefVersion);
90 ASSERT_EQ(0, prefs->GetInteger(prefs::kNTPPrefVersion)); 88 ASSERT_EQ(0, prefs->GetInteger(prefs::kNTPPrefVersion));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 L"})()" 155 L"})()"
158 L")", 156 L")",
159 &has_class)); 157 &has_class));
160 ASSERT_TRUE(has_class); 158 ASSERT_TRUE(has_class);
161 159
162 bool is_home_page; 160 bool is_home_page;
163 ASSERT_TRUE(browser->GetBooleanPreference(prefs::kHomePageIsNewTabPage, 161 ASSERT_TRUE(browser->GetBooleanPreference(prefs::kHomePageIsNewTabPage,
164 &is_home_page)); 162 &is_home_page));
165 ASSERT_TRUE(is_home_page); 163 ASSERT_TRUE(is_home_page);
166 } 164 }
167
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/dom_ui/shown_sections_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698