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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.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/autofill/core/browser/autofill_profile.h" | 25 #include "components/autofill/core/browser/autofill_profile.h" |
26 #include "components/autofill/core/browser/autofill_test_utils.h" | 26 #include "components/autofill/core/browser/autofill_test_utils.h" |
27 #include "components/autofill/core/browser/personal_data_manager.h" | 27 #include "components/autofill/core/browser/personal_data_manager.h" |
28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
29 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
30 | 30 |
31 #if defined(TOOLKIT_GTK) | |
32 #include <gtk/gtk.h> | |
33 #endif | |
34 | |
35 using autofill::AutofillProfile; | 31 using autofill::AutofillProfile; |
36 using autofill::PersonalDataManager; | 32 using autofill::PersonalDataManager; |
37 | 33 |
38 static const base::FilePath::CharType* kWebUIBidiCheckerLibraryJS = | 34 static const base::FilePath::CharType* kWebUIBidiCheckerLibraryJS = |
39 FILE_PATH_LITERAL("third_party/bidichecker/bidichecker_packaged.js"); | 35 FILE_PATH_LITERAL("third_party/bidichecker/bidichecker_packaged.js"); |
40 | 36 |
41 namespace { | 37 namespace { |
42 base::FilePath WebUIBidiCheckerLibraryJSPath() { | 38 base::FilePath WebUIBidiCheckerLibraryJSPath() { |
43 base::FilePath src_root; | 39 base::FilePath src_root; |
44 if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_root)) | 40 if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_root)) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 base::FilePath pak_path; | 121 base::FilePath pak_path; |
126 app_locale_ = base::i18n::GetConfiguredLocale(); | 122 app_locale_ = base::i18n::GetConfiguredLocale(); |
127 ASSERT_TRUE(PathService::Get(base::FILE_MODULE, &pak_path)); | 123 ASSERT_TRUE(PathService::Get(base::FILE_MODULE, &pak_path)); |
128 pak_path = pak_path.DirName(); | 124 pak_path = pak_path.DirName(); |
129 pak_path = pak_path.AppendASCII("pseudo_locales"); | 125 pak_path = pak_path.AppendASCII("pseudo_locales"); |
130 pak_path = pak_path.AppendASCII("fake-bidi"); | 126 pak_path = pak_path.AppendASCII("fake-bidi"); |
131 pak_path = pak_path.ReplaceExtension(FILE_PATH_LITERAL("pak")); | 127 pak_path = pak_path.ReplaceExtension(FILE_PATH_LITERAL("pak")); |
132 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(pak_path); | 128 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(pak_path); |
133 ReloadLocaleResources("he"); | 129 ReloadLocaleResources("he"); |
134 base::i18n::SetICUDefaultLocale("he"); | 130 base::i18n::SetICUDefaultLocale("he"); |
135 #if defined(OS_POSIX) && defined(TOOLKIT_GTK) | |
136 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); | |
137 #endif | |
138 } | 131 } |
139 | 132 |
140 void WebUIBidiCheckerBrowserTestRTL::CleanUpOnMainThread() { | 133 void WebUIBidiCheckerBrowserTestRTL::CleanUpOnMainThread() { |
141 WebUIBidiCheckerBrowserTest::CleanUpOnMainThread(); | 134 WebUIBidiCheckerBrowserTest::CleanUpOnMainThread(); |
142 #if defined(OS_POSIX) && defined(TOOLKIT_GTK) | |
143 gtk_widget_set_default_direction(GTK_TEXT_DIR_LTR); | |
144 #endif | |
145 | 135 |
146 base::i18n::SetICUDefaultLocale(app_locale_); | 136 base::i18n::SetICUDefaultLocale(app_locale_); |
147 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest( | 137 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest( |
148 base::FilePath()); | 138 base::FilePath()); |
149 ReloadLocaleResources(app_locale_); | 139 ReloadLocaleResources(app_locale_); |
150 } | 140 } |
151 | 141 |
152 // Tests | 142 // Tests |
153 | 143 |
154 //============================== | 144 //============================== |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 // chrome://history-frame | 721 // chrome://history-frame |
732 //============================== | 722 //============================== |
733 | 723 |
734 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestHistoryFrame) { | 724 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestHistoryFrame) { |
735 RunBidiCheckerOnPage(chrome::kChromeUIHistoryFrameURL); | 725 RunBidiCheckerOnPage(chrome::kChromeUIHistoryFrameURL); |
736 } | 726 } |
737 | 727 |
738 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, TestHistoryFrame) { | 728 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, TestHistoryFrame) { |
739 RunBidiCheckerOnPage(chrome::kChromeUIHistoryFrameURL); | 729 RunBidiCheckerOnPage(chrome::kChromeUIHistoryFrameURL); |
740 } | 730 } |
OLD | NEW |