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

Side by Side Diff: chrome/browser/ui/webui/bidi_checker_web_ui_test.cc

Issue 8228009: Adding more bidichecker tests and doing some minor cleanups. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixing comments Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/bidi_checker_web_ui_test.h" 5 #include "chrome/browser/ui/webui/bidi_checker_web_ui_test.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/autofill/autofill_common_test.h" 12 #include "chrome/browser/autofill/autofill_common_test.h"
13 #include "chrome/browser/autofill/autofill_profile.h" 13 #include "chrome/browser/autofill/autofill_profile.h"
14 #include "chrome/browser/autofill/personal_data_manager.h" 14 #include "chrome/browser/autofill/personal_data_manager.h"
15 #include "chrome/browser/autofill/personal_data_manager_factory.h" 15 #include "chrome/browser/autofill/personal_data_manager_factory.h"
16 #include "chrome/browser/history/history.h" 16 #include "chrome/browser/history/history.h"
17 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/browser/prefs/session_startup_pref.h"
17 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
19 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
20 #include "chrome/test/base/ui_test_utils.h" 22 #include "chrome/test/base/ui_test_utils.h"
21 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
22 24
23 #if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK) 25 #if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK)
24 #include <gtk/gtk.h> 26 #include <gtk/gtk.h>
25 #endif 27 #endif
26 28
(...skipping 23 matching lines...) Expand all
50 } 52 }
51 53
52 void WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(const char pageURL[], 54 void WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(const char pageURL[],
53 bool isRTL) { 55 bool isRTL) {
54 ui_test_utils::NavigateToURL(browser(), GURL(pageURL)); 56 ui_test_utils::NavigateToURL(browser(), GURL(pageURL));
55 ASSERT_TRUE(RunJavascriptTest("runBidiChecker", 57 ASSERT_TRUE(RunJavascriptTest("runBidiChecker",
56 Value::CreateStringValue(pageURL), 58 Value::CreateStringValue(pageURL),
57 Value::CreateBooleanValue(isRTL))); 59 Value::CreateBooleanValue(isRTL)));
58 } 60 }
59 61
60 // WebUIBidiCheckerBrowserTestFakeBidi 62 void WebUIBidiCheckerBrowserTestLTR::RunBidiCheckerOnPage(
63 const char pageURL[]) {
64 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(pageURL, false);
65 }
61 66
62 WebUIBidiCheckerBrowserTestFakeBidi::~WebUIBidiCheckerBrowserTestFakeBidi() {} 67 void WebUIBidiCheckerBrowserTestRTL::RunBidiCheckerOnPage(
68 const char pageURL[]) {
69 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(pageURL, true);
70 }
63 71
64 WebUIBidiCheckerBrowserTestFakeBidi::WebUIBidiCheckerBrowserTestFakeBidi() {} 72 void WebUIBidiCheckerBrowserTestRTL::SetUpOnMainThread() {
65
66 void WebUIBidiCheckerBrowserTestFakeBidi::SetUpOnMainThread() {
67 WebUIBidiCheckerBrowserTest::SetUpOnMainThread(); 73 WebUIBidiCheckerBrowserTest::SetUpOnMainThread();
68 FilePath pak_path; 74 FilePath pak_path;
69 app_locale_ = base::i18n::GetConfiguredLocale(); 75 app_locale_ = base::i18n::GetConfiguredLocale();
70 ASSERT_TRUE(PathService::Get(base::FILE_MODULE, &pak_path)); 76 ASSERT_TRUE(PathService::Get(base::FILE_MODULE, &pak_path));
71 pak_path = pak_path.DirName(); 77 pak_path = pak_path.DirName();
72 pak_path = pak_path.AppendASCII("pseudo_locales"); 78 pak_path = pak_path.AppendASCII("pseudo_locales");
73 pak_path = pak_path.AppendASCII("fake-bidi"); 79 pak_path = pak_path.AppendASCII("fake-bidi");
74 pak_path = pak_path.ReplaceExtension(FILE_PATH_LITERAL("pak")); 80 pak_path = pak_path.ReplaceExtension(FILE_PATH_LITERAL("pak"));
75 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(pak_path); 81 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(pak_path);
76 ResourceBundle::ReloadSharedInstance("he"); 82 ResourceBundle::ReloadSharedInstance("he");
77 base::i18n::SetICUDefaultLocale("he"); 83 base::i18n::SetICUDefaultLocale("he");
78 #if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK) 84 #if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK)
79 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); 85 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL);
80 #endif 86 #endif
81 } 87 }
82 88
83 void WebUIBidiCheckerBrowserTestFakeBidi::CleanUpOnMainThread() { 89 void WebUIBidiCheckerBrowserTestRTL::CleanUpOnMainThread() {
84 WebUIBidiCheckerBrowserTest::CleanUpOnMainThread(); 90 WebUIBidiCheckerBrowserTest::CleanUpOnMainThread();
85 #if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK) 91 #if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK)
86 gtk_widget_set_default_direction(GTK_TEXT_DIR_LTR); 92 gtk_widget_set_default_direction(GTK_TEXT_DIR_LTR);
87 #endif 93 #endif
88 base::i18n::SetICUDefaultLocale(app_locale_); 94 base::i18n::SetICUDefaultLocale(app_locale_);
89 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(FilePath()); 95 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(FilePath());
90 ResourceBundle::ReloadSharedInstance(app_locale_); 96 ResourceBundle::ReloadSharedInstance(app_locale_);
91 } 97 }
92 98
93 // Tests 99 // Tests
94 100
95 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestMainHistoryPageLTR) { 101 // chrome://history
jeremy 2011/10/30 09:59:19 //=== lines are missing for this one.
ofri1 2011/10/30 12:52:14 Done.
102
103 static void SetupTestHistoryPage(Browser* browser,
jeremy 2011/10/30 09:59:19 nit: I think this would be clearer if all these fu
ofri1 2011/10/30 12:52:14 Done.
104 std::string page_url,
105 std::string page_title) {
jeremy 2011/10/30 09:59:19 nit: pass these in as const references.
ofri1 2011/10/30 12:52:14 Done.
96 HistoryService* history_service = 106 HistoryService* history_service =
97 browser()->profile()->GetHistoryService(Profile::IMPLICIT_ACCESS); 107 browser->profile()->GetHistoryService(Profile::IMPLICIT_ACCESS);
98 GURL history_url = GURL("http://www.ynet.co.il"); 108 const GURL history_url = GURL(page_url);
99 history_service->AddPage(history_url, history::SOURCE_BROWSED); 109 history_service->AddPage(history_url, history::SOURCE_BROWSED);
100 string16 title; 110 history_service->SetPageTitle(history_url, UTF8ToUTF16(page_title));
101 ASSERT_TRUE(UTF8ToUTF16("\xD7\x91\xD7\x93\xD7\x99\xD7\xA7\xD7\x94\x21",
102 12,
103 &title));
104 history_service->SetPageTitle(history_url, title);
105 RunBidiCheckerOnPage(chrome::kChromeUIHistoryURL, false);
106 } 111 }
107 112
108 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, 113 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestHistoryPage) {
109 TestMainHistoryPageRTL) { 114 // Test an Israeli news site with a Hebrew title
110 HistoryService* history_service = 115 SetupTestHistoryPage(browser(),
111 browser()->profile()->GetHistoryService(Profile::IMPLICIT_ACCESS); 116 "http://www.ynet.co.il",
112 GURL history_url = GURL("http://www.google.com"); 117 "\xD7\x91\xD7\x93\xD7\x99\xD7\xA7\xD7\x94\x21");
113 history_service->AddPage(history_url, history::SOURCE_BROWSED); 118 RunBidiCheckerOnPage(chrome::kChromeUIHistoryURL);
114 string16 title = UTF8ToUTF16("Google");
115 history_service->SetPageTitle(history_url, title);
116 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUIHistoryURL,
117 true);
118 } 119 }
119 120
120 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestAboutPageLTR) { 121 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, TestHistoryPage) {
121 RunBidiCheckerOnPage(chrome::kChromeUIAboutURL, false); 122 SetupTestHistoryPage(browser(), "http://www.google.com", "Google");
123 RunBidiCheckerOnPage(chrome::kChromeUIHistoryURL);
122 } 124 }
123 125
124 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestBugReportPageLTR) { 126 //==============================
125 RunBidiCheckerOnPage(chrome::kChromeUIBugReportURL, false); 127 // chrome://about
128 //==============================
129
130 // This page isn't localized to an RTL language so we test it only in English.
131 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestAboutPage) {
132 RunBidiCheckerOnPage(chrome::kChromeUIAboutURL);
126 } 133 }
127 134
128 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestCrashesPageLTR) { 135 //==============================
129 RunBidiCheckerOnPage(chrome::kChromeUICrashesURL, false); 136 // chrome://bugreport
137 //==============================
138
139 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestBugReportPage) {
140 // The bugreport page receives its contents as GET arguments. Here we provide
141 // a custom, Hebrew typed, description message.
142 RunBidiCheckerOnPage(
143 "chrome://bugreport#0?description=%D7%91%D7%93%D7%99%D7%A7%D7%94"
144 "&issueType=1");
jeremy 2011/10/30 09:59:19 I think string continuations should be lined up wi
ofri1 2011/10/30 12:52:14 Done.
130 } 145 }
131 146
132 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, 147 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
133 TestCrashesPageRTL) { 148 TestBugReportPage) {
134 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUICrashesURL, 149 RunBidiCheckerOnPage("chrome://bugreport#0?description=test&issueType=1");
135 true);
136 } 150 }
137 151
138 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestDownloadsPageLTR) { 152 //==============================
139 RunBidiCheckerOnPage(chrome::kChromeUIDownloadsURL, false); 153 // chrome://crashes
154 //==============================
155
156 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestCrashesPage) {
157 RunBidiCheckerOnPage(chrome::kChromeUICrashesURL);
140 } 158 }
141 159
142 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, 160 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, TestCrashesPage) {
143 TestDownloadsPageRTL) { 161 RunBidiCheckerOnPage(chrome::kChromeUICrashesURL);
144 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(
145 chrome::kChromeUIDownloadsURL, true);
146 } 162 }
147 163
148 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestNewTabPageLTR) { 164 //==============================
149 RunBidiCheckerOnPage(chrome::kChromeUINewTabURL, false); 165 // chrome://downloads
166 //==============================
167
168 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestDownloadsPage) {
169 RunBidiCheckerOnPage(chrome::kChromeUIDownloadsURL);
170 }
171
172 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, TestDownloadsPage) {
173 RunBidiCheckerOnPage(chrome::kChromeUIDownloadsURL);
174 }
175
176 //==============================
177 // chrome://newtab
178 //==============================
179
180 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestNewTabPage) {
181 RunBidiCheckerOnPage(chrome::kChromeUINewTabURL);
150 } 182 }
151 183
152 // http://crbug.com/97453 184 // http://crbug.com/97453
153 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, 185 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
154 DISABLED_TestNewTabPageRTL) { 186 DISABLED_TestNewTabPage) {
155 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUINewTabURL, 187 RunBidiCheckerOnPage(chrome::kChromeUINewTabURL);
156 true);
157 } 188 }
158 189
159 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestPluginsPageLTR) { 190 //==============================
160 RunBidiCheckerOnPage(chrome::kChromeUIPluginsURL, false); 191 // chrome://plugins
192 //==============================
193
194 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestPluginsPage) {
195 RunBidiCheckerOnPage(chrome::kChromeUIPluginsURL);
161 } 196 }
162 197
163 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, 198 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, TestPluginsPage) {
164 TestPluginsPageRTL) { 199 RunBidiCheckerOnPage(chrome::kChromeUIPluginsURL);
165 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUIPluginsURL,
166 true);
167 } 200 }
168 201
169 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestSettingsPageLTR) { 202 //==============================
170 RunBidiCheckerOnPage(chrome::kChromeUISettingsURL, false); 203 // chrome://settings
204 //==============================
205
206 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestSettingsPage) {
207 RunBidiCheckerOnPage(chrome::kChromeUISettingsURL);
171 } 208 }
172 209
173 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, 210 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, TestSettingsPage) {
174 TestSettingsPageRTL) { 211 RunBidiCheckerOnPage(chrome::kChromeUISettingsURL);
175 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(
176 chrome::kChromeUISettingsURL, true);
177 } 212 }
178 213
179 #if defined(OS_MACOSX) 214 #if defined(OS_MACOSX)
180 // http://crbug.com/94642 215 // http://crbug.com/94642
181 #define MAYBE_TestSettingsAutofillPageLTR FLAKY_TestSettingsAutofillPageLTR 216 #define MAYBE_TestSettingsAutofillPage FLAKY_TestSettingsAutofillPage
182 #elif defined(OS_WIN) 217 #elif defined(OS_WIN)
183 // http://crbug.com/95425 218 // http://crbug.com/95425
184 #define MAYBE_TestSettingsAutofillPageLTR FAILS_TestSettingsAutofillPageLTR 219 #define MAYBE_TestSettingsAutofillPage FAILS_TestSettingsAutofillPage
185 #else 220 #else
186 #define MAYBE_TestSettingsAutofillPageLTR TestSettingsAutofillPageLTR 221 #define MAYBE_TestSettingsAutofillPage TestSettingsAutofillPage
187 #endif // defined(OS_MACOSX) 222 #endif // defined(OS_MACOSX)
188 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, 223
189 MAYBE_TestSettingsAutofillPageLTR) { 224 static void SetupTestSettingsAutofillPage(Profile* profile,
225 const char* first_name,
226 const char* middle_name,
227 const char* last_name,
228 const char* email,
229 const char* company,
230 const char* address1,
231 const char* address2,
232 const char* city,
233 const char* state,
234 const char* zipcode,
235 const char* country,
236 const char* phone) {
237 autofill_test::DisableSystemServices(profile);
238 AutofillProfile autofill_profile;
239 autofill_test::SetProfileInfo(&autofill_profile,
240 first_name,
241 middle_name,
242 last_name,
243 email,
244 company,
245 address1,
246 address2,
247 city,
248 state,
249 zipcode,
250 country,
251 phone);
252 PersonalDataManager* personal_data_manager =
253 PersonalDataManagerFactory::GetForProfile(profile);
254 ASSERT_TRUE(personal_data_manager);
255 personal_data_manager->AddProfile(autofill_profile);
256 }
257
258 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR,
259 TestSettingsAutofillPage) {
260 SetupTestSettingsAutofillPage(browser()->profile(),
261 "\xD7\x9E\xD7\xA9\xD7\x94",
262 "\xD7\x91",
263 "\xD7\x9B\xD7\x94\xD7\x9F",
264 "moshe.b.cohen@biditest.com",
265 "\xD7\x91\xD7\x93\xD7\x99\xD7\xA7\xD7\x94\x20"
266 "\xD7\x91\xD7\xA2\xD7\x9E",
267 "\xD7\x93\xD7\xA8\xD7\x9A\x20\xD7\x9E\xD7\xA0"
268 "\xD7\x97\xD7\x9D\x20\xD7\x91\xD7\x92\xD7"
269 "\x99\xD7\x9F\x20\x32\x33",
270 "\xD7\xA7\xD7\x95\xD7\x9E\xD7\x94\x20\x32\x36",
271 "\xD7\xAA\xD7\x9C\x20\xD7\x90\xD7\x91\xD7\x99"
272 "\xD7\x91",
273 "",
274 "66183",
275 "\xD7\x99\xD7\xA9\xD7\xA8\xD7\x90\xD7\x9C",
276 "0000");
190 std::string url(chrome::kChromeUISettingsURL); 277 std::string url(chrome::kChromeUISettingsURL);
191 url += std::string(chrome::kAutofillSubPage); 278 url += std::string(chrome::kAutofillSubPage);
192 279 RunBidiCheckerOnPage(url.c_str());
193 autofill_test::DisableSystemServices(browser()->profile());
194 AutofillProfile profile;
195 autofill_test::SetProfileInfo(
196 &profile,
197 "\xD7\x9E\xD7\xA9\xD7\x94",
198 "\xD7\x91",
199 "\xD7\x9B\xD7\x94\xD7\x9F",
200 "moshe.b.cohen@biditest.com",
201 "\xD7\x91\xD7\x93\xD7\x99\xD7\xA7\xD7\x94\x20\xD7\x91\xD7\xA2\xD7\x9E",
202 "\xD7\x93\xD7\xA8\xD7\x9A\x20\xD7\x9E\xD7\xA0\xD7\x97\xD7\x9D\x20\xD7\x91\ xD7\x92\xD7\x99\xD7\x9F\x20\x32\x33",
203 "\xD7\xA7\xD7\x95\xD7\x9E\xD7\x94\x20\x32\x36",
204 "\xD7\xAA\xD7\x9C\x20\xD7\x90\xD7\x91\xD7\x99\xD7\x91",
205 "",
206 "66183",
207 "\xD7\x99\xD7\xA9\xD7\xA8\xD7\x90\xD7\x9C",
208 "0000");
209
210 PersonalDataManager* personal_data_manager =
211 PersonalDataManagerFactory::GetForProfile(browser()->profile());
212 ASSERT_TRUE(personal_data_manager);
213
214 personal_data_manager->AddProfile(profile);
215
216 RunBidiCheckerOnPage(url.c_str(), false);
217 } 280 }
218 281
219 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, 282 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
220 TestSettingsAutofillPageRTL) { 283 TestSettingsAutofillPage) {
221 std::string url(chrome::kChromeUISettingsURL); 284 SetupTestSettingsAutofillPage(browser()->profile(),
222 url += std::string(chrome::kAutofillSubPage);
223
224 autofill_test::DisableSystemServices(browser()->profile());
225 AutofillProfile profile;
226 autofill_test::SetProfileInfo(
227 &profile,
228 "Milton", 285 "Milton",
229 "C.", 286 "C.",
230 "Waddams", 287 "Waddams",
231 "red.swingline@initech.com", 288 "red.swingline@initech.com",
232 "Initech", 289 "Initech",
233 "4120 Freidrich Lane", 290 "4120 Freidrich Lane",
234 "Basement", 291 "Basement",
235 "Austin", 292 "Austin",
236 "Texas", 293 "Texas",
237 "78744", 294 "78744",
238 "United States", 295 "United States",
239 "5125551234"); 296 "5125551234");
297 std::string url(chrome::kChromeUISettingsURL);
298 url += std::string(chrome::kAutofillSubPage);
299 RunBidiCheckerOnPage(url.c_str());
300 }
240 301
241 PersonalDataManager* personal_data_manager = 302 static void SetupTestSettingsBrowserOptions(Profile* profile,
242 PersonalDataManagerFactory::GetForProfile(browser()->profile()); 303 const GURL url,
243 ASSERT_TRUE(personal_data_manager); 304 const std::string title) {
305 // First, add a history entry for the site. This is needed so the site's
306 // name will appear in the startup sites lists.
307 HistoryService* history_service =
308 profile->GetHistoryService(Profile::IMPLICIT_ACCESS);
309 history_service->AddPage(url, history::SOURCE_BROWSED);
310 history_service->SetPageTitle(url, UTF8ToUTF16(title));
311 // Next, add the site to the startup sites
312 PrefService* prefs = profile->GetPrefs();
313 SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs);
314 pref.urls.push_back(url);
315 SessionStartupPref::SetStartupPref(prefs, pref);
316 }
244 317
245 personal_data_manager->AddProfile(profile); 318 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR,
319 TestSettingsBrowserOptionsPage) {
320 SetupTestSettingsBrowserOptions(browser()->profile(),
321 GURL("http://ynet.co.il"),
322 "\x79\x6E\x65\x74\x20\xD7\x97\xD7\x93\xD7\xA9"
323 "\xD7\x95"
324 "\xD7\xAA\x20\xD7\xAA\xD7\x95\xD7\x9B\xD7\x9F"
325 "\x20\xD7"
326 "\x95\xD7\xA2\xD7\x93\xD7\x9B\xD7\x95\xD7\xA0"
327 "\xD7\x99"
328 "\xD7\x9D\x20\x2D\x20\xD7\x99\xD7\x93\xD7\x99"
329 "\xD7\xA2"
330 "\xD7\x95\xD7\xAA\x20\xD7\x90\xD7\x97\xD7\xA8"
331 "\xD7\x95"
332 "\xD7\xA0\xD7\x95\xD7\xAA");
333 std::string url(chrome::kChromeUISettingsURL);
334 url += std::string(chrome::kBrowserOptionsSubPage);
335 RunBidiCheckerOnPage(url.c_str());
336 }
246 337
247 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(url.c_str(), true); 338 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
339 TestSettingsBrowserOptionsPage) {
340 SetupTestSettingsBrowserOptions(browser()->profile(),
341 GURL("http://google.com"),
342 "Google");
343 std::string url(chrome::kChromeUISettingsURL);
344 url += std::string(chrome::kBrowserOptionsSubPage);
345 RunBidiCheckerOnPage(url.c_str());
248 } 346 }
347
348 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR,
349 TestSettingsClearBrowserDataPage) {
350 std::string url(chrome::kChromeUISettingsURL);
351 url += std::string(chrome::kClearBrowserDataSubPage);
352 RunBidiCheckerOnPage(url.c_str());
353 }
354
355 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
356 TestSettingsClearBrowserDataPage) {
357 std::string url(chrome::kChromeUISettingsURL);
358 url += std::string(chrome::kClearBrowserDataSubPage);
359 RunBidiCheckerOnPage(url.c_str());
360 }
361
362 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR,
363 TestSettingsContentSettingsPage) {
364 std::string url(chrome::kChromeUISettingsURL);
365 url += std::string(chrome::kContentSettingsSubPage);
366 RunBidiCheckerOnPage(url.c_str());
367 }
368
369 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
370 TestSettingsContentSettingsPage) {
371 std::string url(chrome::kChromeUISettingsURL);
372 url += std::string(chrome::kContentSettingsSubPage);
373 RunBidiCheckerOnPage(url.c_str());
374 }
375
376 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR,
377 TestSettingsContentSettingsExceptionsPage) {
378 std::string url(chrome::kChromeUISettingsURL);
379 url += std::string(chrome::kContentSettingsExceptionsSubPage);
380 RunBidiCheckerOnPage(url.c_str());
381 }
382
383 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
384 TestSettingsContentSettingsExceptionsPage) {
385 std::string url(chrome::kChromeUISettingsURL);
386 url += std::string(chrome::kContentSettingsExceptionsSubPage);
387 RunBidiCheckerOnPage(url.c_str());
388 }
389
390 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR,
391 TestSettingsLanguageOptionsPage) {
392 std::string url(chrome::kChromeUISettingsURL);
393 url += std::string(chrome::kLanguageOptionsSubPage);
394 RunBidiCheckerOnPage(url.c_str());
395 }
396
397 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
398 TestSettingsLanguageOptionsPage) {
399 std::string url(chrome::kChromeUISettingsURL);
400 url += std::string(chrome::kLanguageOptionsSubPage);
401 RunBidiCheckerOnPage(url.c_str());
402 }
403
404 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR,
405 TestSettingsSearchEnginesOptionsPage) {
406 std::string url(chrome::kChromeUISettingsURL);
407 url += std::string(chrome::kSearchEnginesSubPage);
408 RunBidiCheckerOnPage(url.c_str());
409 }
410
411 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
412 TestSettingsSearchEnginesOptionsPage) {
413 std::string url(chrome::kChromeUISettingsURL);
414 url += std::string(chrome::kSearchEnginesSubPage);
415 RunBidiCheckerOnPage(url.c_str());
416 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698