Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 17 matching lines...) Expand all Loading... | |
| 44 WebUIBidiCheckerBrowserTest::WebUIBidiCheckerBrowserTest() {} | 46 WebUIBidiCheckerBrowserTest::WebUIBidiCheckerBrowserTest() {} |
| 45 | 47 |
| 46 void WebUIBidiCheckerBrowserTest::SetUpInProcessBrowserTestFixture() { | 48 void WebUIBidiCheckerBrowserTest::SetUpInProcessBrowserTestFixture() { |
| 47 WebUIBrowserTest::SetUpInProcessBrowserTestFixture(); | 49 WebUIBrowserTest::SetUpInProcessBrowserTestFixture(); |
| 48 WebUIBrowserTest::AddLibrary(WebUIBidiCheckerLibraryJSPath()); | 50 WebUIBrowserTest::AddLibrary(WebUIBidiCheckerLibraryJSPath()); |
| 49 WebUIBrowserTest::AddLibrary(FilePath(kBidiCheckerTestsJS)); | 51 WebUIBrowserTest::AddLibrary(FilePath(kBidiCheckerTestsJS)); |
| 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 if (pageURL) |
|
jeremy
2011/10/16 12:54:59
What is this line supposed to do?
ofri1
2011/10/23 15:22:36
Hmm, no idea. Removed.
| |
| 57 ui_test_utils::NavigateToURL(browser(), GURL(pageURL)); | |
| 55 ASSERT_TRUE(RunJavascriptTest("runBidiChecker", | 58 ASSERT_TRUE(RunJavascriptTest("runBidiChecker", |
| 56 Value::CreateStringValue(pageURL), | 59 Value::CreateStringValue(pageURL), |
| 57 Value::CreateBooleanValue(isRTL))); | 60 Value::CreateBooleanValue(isRTL))); |
| 58 } | 61 } |
| 59 | 62 |
| 63 void WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(const char pageURL[]) { | |
| 64 RunBidiCheckerOnPage(pageURL, false); | |
| 65 } | |
| 66 | |
| 60 // WebUIBidiCheckerBrowserTestFakeBidi | 67 // WebUIBidiCheckerBrowserTestFakeBidi |
| 61 | 68 |
| 62 WebUIBidiCheckerBrowserTestFakeBidi::~WebUIBidiCheckerBrowserTestFakeBidi() {} | 69 WebUIBidiCheckerBrowserTestFakeBidi::~WebUIBidiCheckerBrowserTestFakeBidi() {} |
| 63 | 70 |
| 64 WebUIBidiCheckerBrowserTestFakeBidi::WebUIBidiCheckerBrowserTestFakeBidi() {} | 71 WebUIBidiCheckerBrowserTestFakeBidi::WebUIBidiCheckerBrowserTestFakeBidi() {} |
| 65 | 72 |
| 73 void WebUIBidiCheckerBrowserTestFakeBidi::RunBidiCheckerOnPage( | |
| 74 const char pageURL[]) { | |
| 75 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(pageURL, true); | |
| 76 } | |
| 77 | |
| 66 void WebUIBidiCheckerBrowserTestFakeBidi::SetUpOnMainThread() { | 78 void WebUIBidiCheckerBrowserTestFakeBidi::SetUpOnMainThread() { |
| 67 WebUIBidiCheckerBrowserTest::SetUpOnMainThread(); | 79 WebUIBidiCheckerBrowserTest::SetUpOnMainThread(); |
| 68 FilePath pak_path; | 80 FilePath pak_path; |
| 69 app_locale_ = base::i18n::GetConfiguredLocale(); | 81 app_locale_ = base::i18n::GetConfiguredLocale(); |
| 70 ASSERT_TRUE(PathService::Get(base::FILE_MODULE, &pak_path)); | 82 ASSERT_TRUE(PathService::Get(base::FILE_MODULE, &pak_path)); |
| 71 pak_path = pak_path.DirName(); | 83 pak_path = pak_path.DirName(); |
| 72 pak_path = pak_path.AppendASCII("pseudo_locales"); | 84 pak_path = pak_path.AppendASCII("pseudo_locales"); |
| 73 pak_path = pak_path.AppendASCII("fake-bidi"); | 85 pak_path = pak_path.AppendASCII("fake-bidi"); |
| 74 pak_path = pak_path.ReplaceExtension(FILE_PATH_LITERAL("pak")); | 86 pak_path = pak_path.ReplaceExtension(FILE_PATH_LITERAL("pak")); |
| 75 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(pak_path); | 87 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(pak_path); |
| 76 ResourceBundle::ReloadSharedInstance("he"); | 88 ResourceBundle::ReloadSharedInstance("he"); |
| 77 base::i18n::SetICUDefaultLocale("he"); | 89 base::i18n::SetICUDefaultLocale("he"); |
| 78 #if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK) | 90 #if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK) |
| 79 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); | 91 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); |
| 80 #endif | 92 #endif |
| 81 } | 93 } |
| 82 | 94 |
| 83 void WebUIBidiCheckerBrowserTestFakeBidi::CleanUpOnMainThread() { | 95 void WebUIBidiCheckerBrowserTestFakeBidi::CleanUpOnMainThread() { |
| 84 WebUIBidiCheckerBrowserTest::CleanUpOnMainThread(); | 96 WebUIBidiCheckerBrowserTest::CleanUpOnMainThread(); |
| 85 #if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK) | 97 #if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK) |
| 86 gtk_widget_set_default_direction(GTK_TEXT_DIR_LTR); | 98 gtk_widget_set_default_direction(GTK_TEXT_DIR_LTR); |
| 87 #endif | 99 #endif |
| 88 base::i18n::SetICUDefaultLocale(app_locale_); | 100 base::i18n::SetICUDefaultLocale(app_locale_); |
| 89 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(FilePath()); | 101 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(FilePath()); |
| 90 ResourceBundle::ReloadSharedInstance(app_locale_); | 102 ResourceBundle::ReloadSharedInstance(app_locale_); |
| 91 } | 103 } |
| 92 | 104 |
| 93 // Tests | 105 // Tests |
| 94 | 106 |
| 95 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestMainHistoryPageLTR) { | 107 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestMainHistoryPage) { |
|
jeremy
2011/10/16 12:54:59
This only tests the page as LTR, right so why rena
| |
| 96 HistoryService* history_service = | 108 HistoryService* history_service = |
| 97 browser()->profile()->GetHistoryService(Profile::IMPLICIT_ACCESS); | 109 browser()->profile()->GetHistoryService(Profile::IMPLICIT_ACCESS); |
| 98 GURL history_url = GURL("http://www.ynet.co.il"); | 110 const GURL history_url = GURL("http://www.ynet.co.il"); |
| 99 history_service->AddPage(history_url, history::SOURCE_BROWSED); | 111 history_service->AddPage(history_url, history::SOURCE_BROWSED); |
| 100 string16 title; | 112 string16 title; |
| 101 ASSERT_TRUE(UTF8ToUTF16("\xD7\x91\xD7\x93\xD7\x99\xD7\xA7\xD7\x94\x21", | 113 ASSERT_TRUE(UTF8ToUTF16("\xD7\x91\xD7\x93\xD7\x99\xD7\xA7\xD7\x94\x21", |
| 102 12, | 114 12, |
| 103 &title)); | 115 &title)); |
| 104 history_service->SetPageTitle(history_url, title); | 116 history_service->SetPageTitle(history_url, title); |
| 105 RunBidiCheckerOnPage(chrome::kChromeUIHistoryURL, false); | 117 RunBidiCheckerOnPage(chrome::kChromeUIHistoryURL); |
| 106 } | 118 } |
| 107 | 119 |
| 108 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, | 120 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, |
| 109 TestMainHistoryPageRTL) { | 121 TestMainHistoryPage) { |
| 110 HistoryService* history_service = | 122 HistoryService* history_service = |
| 111 browser()->profile()->GetHistoryService(Profile::IMPLICIT_ACCESS); | 123 browser()->profile()->GetHistoryService(Profile::IMPLICIT_ACCESS); |
| 112 GURL history_url = GURL("http://www.google.com"); | 124 const GURL history_url = GURL("http://www.google.com"); |
| 113 history_service->AddPage(history_url, history::SOURCE_BROWSED); | 125 history_service->AddPage(history_url, history::SOURCE_BROWSED); |
| 114 string16 title = UTF8ToUTF16("Google"); | 126 string16 title = UTF8ToUTF16("Google"); |
| 115 history_service->SetPageTitle(history_url, title); | 127 history_service->SetPageTitle(history_url, title); |
| 116 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUIHistoryURL, | 128 RunBidiCheckerOnPage(chrome::kChromeUIHistoryURL); |
| 117 true); | |
| 118 } | 129 } |
| 119 | 130 |
| 120 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestAboutPageLTR) { | 131 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestAboutPage) { |
| 121 RunBidiCheckerOnPage(chrome::kChromeUIAboutURL, false); | 132 RunBidiCheckerOnPage(chrome::kChromeUIAboutURL); |
| 122 } | 133 } |
| 123 | 134 |
| 124 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestBugReportPageLTR) { | 135 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestBugReportPage) { |
| 125 RunBidiCheckerOnPage(chrome::kChromeUIBugReportURL, false); | 136 RunBidiCheckerOnPage( |
| 126 } | 137 "chrome://bugreport#0?description=%D7%91%D7%93%D7%99%D7%A7%D7%94&issueType =1"); |
|
jeremy
2011/10/16 12:54:59
Could you add a comment explaining what the weird
ofri1
2011/10/23 15:22:36
Done.
| |
| 127 | |
| 128 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestCrashesPageLTR) { | |
| 129 RunBidiCheckerOnPage(chrome::kChromeUICrashesURL, false); | |
| 130 } | 138 } |
| 131 | 139 |
| 132 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, | 140 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, |
| 141 TestBugReportPage) { | |
| 142 RunBidiCheckerOnPage("chrome://bugreport#0?description=test&issueType=1"); | |
| 143 } | |
| 144 | |
| 145 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestCrashesPage) { | |
| 146 RunBidiCheckerOnPage(chrome::kChromeUICrashesURL); | |
|
jeremy
2011/10/16 12:54:59
I'm pretty sure about:crash isn't HTML and that yo
ofri1
2011/10/23 15:22:36
This is not about:crash but about:crashes, which I
| |
| 147 } | |
| 148 | |
| 149 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, TestCrashesPage) { | |
| 150 RunBidiCheckerOnPage(chrome::kChromeUICrashesURL); | |
| 151 } | |
| 152 | |
| 153 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, | |
| 133 TestCrashesPageRTL) { | 154 TestCrashesPageRTL) { |
| 134 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUICrashesURL, | 155 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUICrashesURL, |
| 135 true); | 156 true); |
| 136 } | 157 } |
| 137 | 158 |
| 138 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestDownloadsPageLTR) { | 159 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestDownloadsPage) { |
| 139 RunBidiCheckerOnPage(chrome::kChromeUIDownloadsURL, false); | 160 RunBidiCheckerOnPage(chrome::kChromeUIDownloadsURL); |
| 140 } | 161 } |
| 141 | 162 |
| 142 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, | 163 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, TestDownloadsPage) { |
| 143 TestDownloadsPageRTL) { | 164 RunBidiCheckerOnPage(chrome::kChromeUIDownloadsURL); |
| 144 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage( | |
| 145 chrome::kChromeUIDownloadsURL, true); | |
| 146 } | 165 } |
| 147 | 166 |
| 148 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestNewTabPageLTR) { | 167 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestNewTabPage) { |
| 149 RunBidiCheckerOnPage(chrome::kChromeUINewTabURL, false); | 168 RunBidiCheckerOnPage(chrome::kChromeUINewTabURL); |
| 150 } | 169 } |
| 151 | 170 |
| 152 // http://crbug.com/97453 | 171 // http://crbug.com/97453 |
| 153 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, | 172 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, |
| 154 DISABLED_TestNewTabPageRTL) { | 173 DISABLED_TestNewTabPage) { |
| 155 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUINewTabURL, | 174 RunBidiCheckerOnPage(chrome::kChromeUINewTabURL); |
| 156 true); | |
| 157 } | 175 } |
| 158 | 176 |
| 159 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestPluginsPageLTR) { | 177 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestPluginsPage) { |
| 160 RunBidiCheckerOnPage(chrome::kChromeUIPluginsURL, false); | 178 RunBidiCheckerOnPage(chrome::kChromeUIPluginsURL); |
| 161 } | 179 } |
| 162 | 180 |
| 163 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, | 181 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, TestPluginsPage) { |
| 164 TestPluginsPageRTL) { | 182 RunBidiCheckerOnPage(chrome::kChromeUIPluginsURL); |
| 165 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUIPluginsURL, | |
| 166 true); | |
| 167 } | 183 } |
| 168 | 184 |
| 169 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestSettingsPageLTR) { | 185 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestSettingsPage) { |
| 170 RunBidiCheckerOnPage(chrome::kChromeUISettingsURL, false); | 186 RunBidiCheckerOnPage(chrome::kChromeUISettingsURL); |
| 171 } | 187 } |
| 172 | 188 |
| 173 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, | 189 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, TestSettingsPage) { |
| 174 TestSettingsPageRTL) { | 190 RunBidiCheckerOnPage(chrome::kChromeUISettingsURL); |
| 175 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage( | |
| 176 chrome::kChromeUISettingsURL, true); | |
| 177 } | 191 } |
| 178 | 192 |
| 179 #if defined(OS_MACOSX) | 193 #if defined(OS_MACOSX) |
| 180 // http://crbug.com/94642 | 194 // http://crbug.com/94642 |
| 181 #define MAYBE_TestSettingsAutofillPageLTR FLAKY_TestSettingsAutofillPageLTR | 195 #define MAYBE_TestSettingsAutofillPage FLAKY_TestSettingsAutofillPage |
|
jeremy
2011/10/16 12:54:59
Are these tests still flaky? Do you know what the
| |
| 182 #elif defined(OS_WIN) | 196 #elif defined(OS_WIN) |
| 183 // http://crbug.com/95425 | 197 // http://crbug.com/95425 |
| 184 #define MAYBE_TestSettingsAutofillPageLTR FAILS_TestSettingsAutofillPageLTR | 198 #define MAYBE_TestSettingsAutofillPage FAILS_TestSettingsAutofillPage |
| 185 #else | 199 #else |
| 186 #define MAYBE_TestSettingsAutofillPageLTR TestSettingsAutofillPageLTR | 200 #define MAYBE_TestSettingsAutofillPage TestSettingsAutofillPage |
| 187 #endif // defined(OS_MACOSX) | 201 #endif // defined(OS_MACOSX) |
| 188 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, | 202 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, |
| 189 MAYBE_TestSettingsAutofillPageLTR) { | 203 MAYBE_TestSettingsAutofillPage) { |
| 190 std::string url(chrome::kChromeUISettingsURL); | 204 std::string url(chrome::kChromeUISettingsURL); |
| 191 url += std::string(chrome::kAutofillSubPage); | 205 url += std::string(chrome::kAutofillSubPage); |
| 192 | 206 |
| 193 autofill_test::DisableSystemServices(browser()->profile()); | 207 autofill_test::DisableSystemServices(browser()->profile()); |
| 194 AutofillProfile profile; | 208 AutofillProfile profile; |
| 195 autofill_test::SetProfileInfo( | 209 autofill_test::SetProfileInfo( |
| 196 &profile, | 210 &profile, |
| 197 "\xD7\x9E\xD7\xA9\xD7\x94", | 211 "\xD7\x9E\xD7\xA9\xD7\x94", |
| 198 "\xD7\x91", | 212 "\xD7\x91", |
| 199 "\xD7\x9B\xD7\x94\xD7\x9F", | 213 "\xD7\x9B\xD7\x94\xD7\x9F", |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 210 PersonalDataManager* personal_data_manager = | 224 PersonalDataManager* personal_data_manager = |
| 211 PersonalDataManagerFactory::GetForProfile(browser()->profile()); | 225 PersonalDataManagerFactory::GetForProfile(browser()->profile()); |
| 212 ASSERT_TRUE(personal_data_manager); | 226 ASSERT_TRUE(personal_data_manager); |
| 213 | 227 |
| 214 personal_data_manager->AddProfile(profile); | 228 personal_data_manager->AddProfile(profile); |
| 215 | 229 |
| 216 RunBidiCheckerOnPage(url.c_str(), false); | 230 RunBidiCheckerOnPage(url.c_str(), false); |
| 217 } | 231 } |
| 218 | 232 |
| 219 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, | 233 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, |
| 220 TestSettingsAutofillPageRTL) { | 234 TestSettingsAutofillPage) { |
| 221 std::string url(chrome::kChromeUISettingsURL); | 235 std::string url(chrome::kChromeUISettingsURL); |
| 222 url += std::string(chrome::kAutofillSubPage); | 236 url += std::string(chrome::kAutofillSubPage); |
| 223 | 237 |
| 224 autofill_test::DisableSystemServices(browser()->profile()); | 238 autofill_test::DisableSystemServices(browser()->profile()); |
| 225 AutofillProfile profile; | 239 AutofillProfile profile; |
| 226 autofill_test::SetProfileInfo( | 240 autofill_test::SetProfileInfo( |
| 227 &profile, | 241 &profile, |
| 228 "Milton", | 242 "Milton", |
| 229 "C.", | 243 "C.", |
| 230 "Waddams", | 244 "Waddams", |
| 231 "red.swingline@initech.com", | 245 "red.swingline@initech.com", |
| 232 "Initech", | 246 "Initech", |
| 233 "4120 Freidrich Lane", | 247 "4120 Freidrich Lane", |
| 234 "Basement", | 248 "Basement", |
| 235 "Austin", | 249 "Austin", |
| 236 "Texas", | 250 "Texas", |
| 237 "78744", | 251 "78744", |
| 238 "United States", | 252 "United States", |
| 239 "5125551234"); | 253 "5125551234"); |
| 240 | 254 |
| 241 PersonalDataManager* personal_data_manager = | 255 PersonalDataManager* personal_data_manager = |
| 242 PersonalDataManagerFactory::GetForProfile(browser()->profile()); | 256 PersonalDataManagerFactory::GetForProfile(browser()->profile()); |
| 243 ASSERT_TRUE(personal_data_manager); | 257 ASSERT_TRUE(personal_data_manager); |
| 244 | 258 |
| 245 personal_data_manager->AddProfile(profile); | 259 personal_data_manager->AddProfile(profile); |
| 246 | 260 |
| 247 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(url.c_str(), true); | 261 RunBidiCheckerOnPage(url.c_str()); |
| 248 } | 262 } |
| 263 | |
| 264 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, | |
| 265 TestSettingsBorwserOptionsPage) { | |
| 266 // A common Israeli news site with mixed Hebrew/English title | |
| 267 GURL testGURL = GURL("http://ynet.co.il"); | |
|
jeremy
2011/10/16 12:54:59
Just to be sure - there's no chance we actually tr
ofri1
2011/10/23 15:22:36
Right. The only way to get to the site is by manua
| |
| 268 // First, add a history entry for the site. This is needed so the site's | |
| 269 // name will appear in the startup sites lists. | |
| 270 HistoryService* history_service = | |
| 271 browser()->profile()->GetHistoryService(Profile::IMPLICIT_ACCESS); | |
|
jeremy
2011/10/16 12:54:59
Indent
ofri1
2011/10/23 15:22:36
Done.
| |
| 272 history_service->AddPage(testGURL, history::SOURCE_BROWSED); | |
| 273 string16 title; | |
| 274 // This is the real title of the site | |
|
jeremy
2011/10/16 12:54:59
nit:End comments with a '.'
| |
| 275 ASSERT_TRUE(UTF8ToUTF16("\x79\x6E\x65\x74\x20\xD7\x97\xD7\x93\xD7\xA9\xD7\x95" | |
| 276 "\xD7\xAA\x20\xD7\xAA\xD7\x95\xD7\x9B\xD7\x9F\x20\xD7" | |
| 277 "\x95\xD7\xA2\xD7\x93\xD7\x9B\xD7\x95\xD7\xA0\xD7\x99" | |
| 278 "\xD7\x9D\x20\x2D\x20\xD7\x99\xD7\x93\xD7\x99\xD7\xA2" | |
| 279 "\xD7\x95\xD7\xAA\x20\xD7\x90\xD7\x97\xD7\xA8\xD7\x95" | |
| 280 "\xD7\xA0\xD7\x95\xD7\xAA", | |
| 281 71, | |
|
jeremy
2011/10/16 12:54:59
put the above in a char[] and use array_size() her
ofri1
2011/10/23 15:22:36
No need, found a cleaner alternative.
| |
| 282 &title)); | |
| 283 history_service->SetPageTitle(testGURL, title); | |
| 284 | |
| 285 // Next, add the site to the startup sites | |
| 286 PrefService* prefs = browser()->profile()->GetPrefs(); | |
| 287 SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs); | |
| 288 pref.urls.push_back(testGURL); | |
| 289 SessionStartupPref::SetStartupPref(prefs, pref); | |
| 290 | |
| 291 // Finally, unleash the BidiChecker | |
| 292 std::string url(chrome::kChromeUISettingsURL); | |
| 293 url += std::string(chrome::kBrowserOptionsSubPage); | |
| 294 RunBidiCheckerOnPage(url.c_str()); | |
| 295 } | |
| 296 | |
| 297 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, | |
| 298 TestSettingsBorwserOptionsPage) { | |
| 299 // A search engine some people use | |
| 300 GURL testGURL = GURL("http://google.com"); | |
|
jeremy
2011/10/16 12:54:59
Since both these tests do the same thing, can you
ofri1
2011/10/23 15:22:36
Done.
| |
| 301 // First, add a history entry for the site. This is needed so the site's | |
| 302 // name will appear in the startup sites lists. | |
| 303 HistoryService* history_service = | |
| 304 browser()->profile()->GetHistoryService(Profile::IMPLICIT_ACCESS); | |
| 305 history_service->AddPage(testGURL, history::SOURCE_BROWSED); | |
| 306 string16 title; | |
| 307 // This is the real title of the site | |
| 308 ASSERT_TRUE(UTF8ToUTF16("Google", | |
| 309 6, | |
| 310 &title)); | |
| 311 history_service->SetPageTitle(testGURL, title); | |
| 312 | |
| 313 // Next, add the site to the startup sites | |
| 314 PrefService* prefs = browser()->profile()->GetPrefs(); | |
| 315 SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs); | |
| 316 pref.urls.push_back(testGURL); | |
| 317 SessionStartupPref::SetStartupPref(prefs, pref); | |
| 318 | |
| 319 // Finally, unleash the BidiChecker | |
| 320 std::string url(chrome::kChromeUISettingsURL); | |
| 321 url += std::string(chrome::kBrowserOptionsSubPage); | |
| 322 RunBidiCheckerOnPage(url.c_str()); | |
| 323 } | |
| 324 | |
| 325 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, | |
| 326 TestSettingsClearBrowserDataPage) { | |
| 327 std::string url(chrome::kChromeUISettingsURL); | |
| 328 url += std::string(chrome::kClearBrowserDataSubPage); | |
| 329 RunBidiCheckerOnPage(url.c_str()); | |
| 330 } | |
| 331 | |
| 332 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, | |
| 333 TestSettingsClearBrowserDataPage) { | |
| 334 std::string url(chrome::kChromeUISettingsURL); | |
| 335 url += std::string(chrome::kClearBrowserDataSubPage); | |
| 336 RunBidiCheckerOnPage(url.c_str()); | |
| 337 } | |
| 338 | |
| 339 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, | |
| 340 TestSettingsContentSettingsPage) { | |
| 341 std::string url(chrome::kChromeUISettingsURL); | |
| 342 url += std::string(chrome::kContentSettingsSubPage); | |
| 343 RunBidiCheckerOnPage(url.c_str()); | |
| 344 } | |
| 345 | |
| 346 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, | |
| 347 TestSettingsContentSettingsPage) { | |
| 348 std::string url(chrome::kChromeUISettingsURL); | |
| 349 url += std::string(chrome::kContentSettingsSubPage); | |
| 350 RunBidiCheckerOnPage(url.c_str()); | |
| 351 } | |
| 352 | |
| 353 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, | |
| 354 TestSettingsContentSettingsExceptionsPage) { | |
| 355 std::string url(chrome::kChromeUISettingsURL); | |
| 356 url += std::string(chrome::kContentSettingsExceptionsSubPage); | |
| 357 RunBidiCheckerOnPage(url.c_str()); | |
| 358 } | |
| 359 | |
| 360 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, | |
| 361 TestSettingsContentSettingsExceptionsPage) { | |
| 362 std::string url(chrome::kChromeUISettingsURL); | |
| 363 url += std::string(chrome::kContentSettingsExceptionsSubPage); | |
| 364 RunBidiCheckerOnPage(url.c_str()); | |
| 365 } | |
| 366 | |
| 367 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, | |
| 368 TestSettingsLanguageOptionsPage) { | |
| 369 std::string url(chrome::kChromeUISettingsURL); | |
| 370 url += std::string(chrome::kLanguageOptionsSubPage); | |
| 371 RunBidiCheckerOnPage(url.c_str()); | |
| 372 } | |
| 373 | |
| 374 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, | |
| 375 TestSettingsLanguageOptionsPage) { | |
| 376 std::string url(chrome::kChromeUISettingsURL); | |
| 377 url += std::string(chrome::kLanguageOptionsSubPage); | |
| 378 RunBidiCheckerOnPage(url.c_str()); | |
| 379 } | |
| 380 | |
| 381 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, | |
| 382 TestSettingsSearchEnginesOptionsPage) { | |
| 383 std::string url(chrome::kChromeUISettingsURL); | |
| 384 url += std::string(chrome::kSearchEnginesSubPage); | |
| 385 RunBidiCheckerOnPage(url.c_str()); | |
| 386 } | |
| 387 | |
| 388 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, | |
| 389 TestSettingsSearchEnginesOptionsPage) { | |
| 390 std::string url(chrome::kChromeUISettingsURL); | |
| 391 url += std::string(chrome::kSearchEnginesSubPage); | |
| 392 RunBidiCheckerOnPage(url.c_str()); | |
| 393 } | |
| OLD | NEW |