| OLD | NEW |
| 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/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" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 const std::string& page_url) { | 63 const std::string& page_url) { |
| 64 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(page_url, false); | 64 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(page_url, false); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void WebUIBidiCheckerBrowserTestRTL::RunBidiCheckerOnPage( | 67 void WebUIBidiCheckerBrowserTestRTL::RunBidiCheckerOnPage( |
| 68 const std::string& page_url) { | 68 const std::string& page_url) { |
| 69 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(page_url, true); | 69 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(page_url, true); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void WebUIBidiCheckerBrowserTestRTL::SetUpOnMainThread() { | 72 void WebUIBidiCheckerBrowserTestRTL::SetUpOnMainThread() { |
| 73 // Ensure that no other page (NTP4, home page, e.g.) is loading when we reload |
| 74 // the locale resources. |
| 75 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); |
| 76 |
| 73 WebUIBidiCheckerBrowserTest::SetUpOnMainThread(); | 77 WebUIBidiCheckerBrowserTest::SetUpOnMainThread(); |
| 74 FilePath pak_path; | 78 FilePath pak_path; |
| 75 app_locale_ = base::i18n::GetConfiguredLocale(); | 79 app_locale_ = base::i18n::GetConfiguredLocale(); |
| 76 ASSERT_TRUE(PathService::Get(base::FILE_MODULE, &pak_path)); | 80 ASSERT_TRUE(PathService::Get(base::FILE_MODULE, &pak_path)); |
| 77 pak_path = pak_path.DirName(); | 81 pak_path = pak_path.DirName(); |
| 78 pak_path = pak_path.AppendASCII("pseudo_locales"); | 82 pak_path = pak_path.AppendASCII("pseudo_locales"); |
| 79 pak_path = pak_path.AppendASCII("fake-bidi"); | 83 pak_path = pak_path.AppendASCII("fake-bidi"); |
| 80 pak_path = pak_path.ReplaceExtension(FILE_PATH_LITERAL("pak")); | 84 pak_path = pak_path.ReplaceExtension(FILE_PATH_LITERAL("pak")); |
| 81 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(pak_path); | 85 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(pak_path); |
| 82 ResourceBundle::GetSharedInstance().ReloadLocaleResources("he"); | 86 ASSERT_FALSE( |
| 87 ResourceBundle::GetSharedInstance().ReloadLocaleResources("he").empty()); |
| 83 base::i18n::SetICUDefaultLocale("he"); | 88 base::i18n::SetICUDefaultLocale("he"); |
| 84 #if defined(OS_POSIX) && defined(TOOLKIT_GTK) | 89 #if defined(OS_POSIX) && defined(TOOLKIT_GTK) |
| 85 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); | 90 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); |
| 86 #endif | 91 #endif |
| 87 } | 92 } |
| 88 | 93 |
| 89 void WebUIBidiCheckerBrowserTestRTL::CleanUpOnMainThread() { | 94 void WebUIBidiCheckerBrowserTestRTL::CleanUpOnMainThread() { |
| 90 WebUIBidiCheckerBrowserTest::CleanUpOnMainThread(); | 95 WebUIBidiCheckerBrowserTest::CleanUpOnMainThread(); |
| 91 #if defined(OS_POSIX) && defined(TOOLKIT_GTK) | 96 #if defined(OS_POSIX) && defined(TOOLKIT_GTK) |
| 92 gtk_widget_set_default_direction(GTK_TEXT_DIR_LTR); | 97 gtk_widget_set_default_direction(GTK_TEXT_DIR_LTR); |
| 93 #endif | 98 #endif |
| 94 base::i18n::SetICUDefaultLocale(app_locale_); | 99 base::i18n::SetICUDefaultLocale(app_locale_); |
| 95 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(FilePath()); | 100 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(FilePath()); |
| 96 ResourceBundle::GetSharedInstance().ReloadLocaleResources(app_locale_); | 101 ASSERT_EQ( |
| 102 app_locale_, |
| 103 ResourceBundle::GetSharedInstance().ReloadLocaleResources(app_locale_)); |
| 97 } | 104 } |
| 98 | 105 |
| 99 // Tests | 106 // Tests |
| 100 | 107 |
| 101 //============================== | 108 //============================== |
| 102 // chrome://settings/history | 109 // chrome://settings/history |
| 103 //============================== | 110 //============================== |
| 104 | 111 |
| 105 static void SetupHistoryPageTest(Browser* browser, | 112 static void SetupHistoryPageTest(Browser* browser, |
| 106 const std::string page_url, | 113 const std::string page_url, |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 // chrome://history-frame | 840 // chrome://history-frame |
| 834 //============================== | 841 //============================== |
| 835 | 842 |
| 836 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestHistoryFrame) { | 843 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestHistoryFrame) { |
| 837 RunBidiCheckerOnPage(chrome::kChromeUIHistoryFrameURL); | 844 RunBidiCheckerOnPage(chrome::kChromeUIHistoryFrameURL); |
| 838 } | 845 } |
| 839 | 846 |
| 840 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, TestHistoryFrame) { | 847 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, TestHistoryFrame) { |
| 841 RunBidiCheckerOnPage(chrome::kChromeUIHistoryFrameURL); | 848 RunBidiCheckerOnPage(chrome::kChromeUIHistoryFrameURL); |
| 842 } | 849 } |
| OLD | NEW |