| 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" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 Value::CreateStringValue(pageURL), | 75 Value::CreateStringValue(pageURL), |
| 76 Value::CreateBooleanValue(isRTL))); | 76 Value::CreateBooleanValue(isRTL))); |
| 77 } | 77 } |
| 78 | 78 |
| 79 // WebUIBidiCheckerBrowserTestFakeBidi | 79 // WebUIBidiCheckerBrowserTestFakeBidi |
| 80 | 80 |
| 81 WebUIBidiCheckerBrowserTestFakeBidi::~WebUIBidiCheckerBrowserTestFakeBidi() {} | 81 WebUIBidiCheckerBrowserTestFakeBidi::~WebUIBidiCheckerBrowserTestFakeBidi() {} |
| 82 | 82 |
| 83 WebUIBidiCheckerBrowserTestFakeBidi::WebUIBidiCheckerBrowserTestFakeBidi() {} | 83 WebUIBidiCheckerBrowserTestFakeBidi::WebUIBidiCheckerBrowserTestFakeBidi() {} |
| 84 | 84 |
| 85 void WebUIBidiCheckerBrowserTestFakeBidi::SetUpInProcessBrowserTestFixture() { | 85 void WebUIBidiCheckerBrowserTestFakeBidi::SetUpOnMainThread() { |
| 86 WebUIBidiCheckerBrowserTest::SetUpInProcessBrowserTestFixture(); | 86 WebUIBidiCheckerBrowserTest::SetUpOnMainThread(); |
| 87 FilePath pak_path; | 87 FilePath pak_path; |
| 88 app_locale_ = base::i18n::GetConfiguredLocale(); | 88 app_locale_ = base::i18n::GetConfiguredLocale(); |
| 89 PathService::Get(base::FILE_MODULE, &pak_path); | 89 ASSERT_TRUE(PathService::Get(base::FILE_MODULE, &pak_path)); |
| 90 pak_path = pak_path.DirName(); | 90 pak_path = pak_path.DirName(); |
| 91 pak_path = pak_path.AppendASCII("pseudo_locales"); | 91 pak_path = pak_path.AppendASCII("pseudo_locales"); |
| 92 pak_path = pak_path.AppendASCII("fake-bidi"); | 92 pak_path = pak_path.AppendASCII("fake-bidi"); |
| 93 pak_path = pak_path.ReplaceExtension(FILE_PATH_LITERAL("pak")); | 93 pak_path = pak_path.ReplaceExtension(FILE_PATH_LITERAL("pak")); |
| 94 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(pak_path); | 94 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(pak_path); |
| 95 ResourceBundle::ReloadSharedInstance("he"); | 95 ResourceBundle::ReloadSharedInstance("he"); |
| 96 #if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK) | 96 #if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK) |
| 97 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); | 97 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); |
| 98 #endif | 98 #endif |
| 99 } | 99 } |
| 100 | 100 |
| 101 void | 101 void WebUIBidiCheckerBrowserTestFakeBidi::CleanUpOnMainThread() { |
| 102 WebUIBidiCheckerBrowserTestFakeBidi::TearDownInProcessBrowserTestFixture() { | 102 WebUIBidiCheckerBrowserTest::CleanUpOnMainThread(); |
| 103 WebUIBidiCheckerBrowserTest::TearDownInProcessBrowserTestFixture(); | |
| 104 #if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK) | 103 #if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK) |
| 105 gtk_widget_set_default_direction(GTK_TEXT_DIR_LTR); | 104 gtk_widget_set_default_direction(GTK_TEXT_DIR_LTR); |
| 106 #endif | 105 #endif |
| 107 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(FilePath()); | 106 ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(FilePath()); |
| 108 ResourceBundle::ReloadSharedInstance(app_locale_); | 107 ResourceBundle::ReloadSharedInstance(app_locale_); |
| 109 } | 108 } |
| 110 | 109 |
| 111 // Tests | 110 // Tests |
| 112 | 111 |
| 113 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestMainHistoryPageLTR) { | 112 IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestMainHistoryPageLTR) { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 "5125551234"); | 255 "5125551234"); |
| 257 | 256 |
| 258 PersonalDataManager* personal_data_manager = | 257 PersonalDataManager* personal_data_manager = |
| 259 browser()->profile()->GetPersonalDataManager(); | 258 browser()->profile()->GetPersonalDataManager(); |
| 260 ASSERT_TRUE(personal_data_manager); | 259 ASSERT_TRUE(personal_data_manager); |
| 261 | 260 |
| 262 personal_data_manager->AddProfile(profile); | 261 personal_data_manager->AddProfile(profile); |
| 263 | 262 |
| 264 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(url.c_str(), true); | 263 WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(url.c_str(), true); |
| 265 } | 264 } |
| OLD | NEW |