summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-18 14:43:25 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-18 14:43:25 +0000
commite9c4ac9c2af1e09044920caf4b7a1ca5f1126ea6 (patch)
tree8d27e69cfe1d3286fc9a57a4141498ea72368d62
parent3e0c7ad746fa9b107ead3b2d84e237e27376e6e9 (diff)
downloadchromium_src-e9c4ac9c2af1e09044920caf4b7a1ca5f1126ea6.zip
chromium_src-e9c4ac9c2af1e09044920caf4b7a1ca5f1126ea6.tar.gz
chromium_src-e9c4ac9c2af1e09044920caf4b7a1ca5f1126ea6.tar.bz2
Revert 97304 - Adding BidiChecker tests which run in fake bidi
All the new tests are failing. BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/7488045 TBR=ofri@google.com Review URL: http://codereview.chromium.org/7669053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97310 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/webui/BidiCheckerWebUITest.cc161
-rw-r--r--chrome/browser/ui/webui/BidiCheckerWebUITest.h18
-rw-r--r--chrome/test/data/webui/bidichecker_tests.js19
-rw-r--r--ui/base/resource/resource_bundle.cc15
-rw-r--r--ui/base/resource/resource_bundle.h7
-rw-r--r--ui/base/resource/resource_bundle_posix.cc10
6 files changed, 25 insertions, 205 deletions
diff --git a/chrome/browser/ui/webui/BidiCheckerWebUITest.cc b/chrome/browser/ui/webui/BidiCheckerWebUITest.cc
index 85a2634..fb58e9b8 100644
--- a/chrome/browser/ui/webui/BidiCheckerWebUITest.cc
+++ b/chrome/browser/ui/webui/BidiCheckerWebUITest.cc
@@ -16,7 +16,6 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/ui_test_utils.h"
-#include "ui/base/resource/resource_bundle.h"
static const FilePath::CharType* kWebUIBidiCheckerLibraryJS =
FILE_PATH_LITERAL("third_party/bidichecker/bidichecker_packaged.js");
@@ -51,35 +50,6 @@ void WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(const char pageURL[],
*Value::CreateBooleanValue(isRTL)));
}
-// WebUIBidiCheckerBrowserTestFakeBidi
-#ifndef OS_WIN
-WebUIBidiCheckerBrowserTestFakeBidi::~WebUIBidiCheckerBrowserTestFakeBidi() {}
-
-WebUIBidiCheckerBrowserTestFakeBidi::WebUIBidiCheckerBrowserTestFakeBidi() {}
-
-void WebUIBidiCheckerBrowserTestFakeBidi::SetUpInProcessBrowserTestFixture() {
- WebUIBidiCheckerBrowserTest::SetUpInProcessBrowserTestFixture();
- FilePath pak_path;
- PathService::Get(base::FILE_MODULE, &pak_path);
- pak_path = pak_path.DirName();
- pak_path = pak_path.Append("pseudo_locales");
- pak_path = pak_path.Append("fake-bidi");
- pak_path = pak_path.ReplaceExtension("pak");
- ResourceBundle::GetSharedInstance().OverrideLocalePak(pak_path);
- ResourceBundle::ReloadSharedInstance("he");
-}
-
-void WebUIBidiCheckerBrowserTestFakeBidi::TearDownInProcessBrowserTestFixture()
-{
- WebUIBidiCheckerBrowserTest::TearDownInProcessBrowserTestFixture();
- FilePath file_path;
- ResourceBundle::GetSharedInstance().OverrideLocalePak(file_path);
- ResourceBundle::ReloadSharedInstance("en");
-}
-#endif // OS_WIN
-
-// Tests
-
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestMainHistoryPageLTR) {
HistoryService* history_service =
browser()->profile()->GetHistoryService(Profile::IMPLICIT_ACCESS);
@@ -93,105 +63,40 @@ IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestMainHistoryPageLTR) {
RunBidiCheckerOnPage(chrome::kChromeUIHistoryURL, false);
}
-#ifndef OS_WIN
-IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi,
- TestMainHistoryPageRTL) {
- HistoryService* history_service =
- browser()->profile()->GetHistoryService(Profile::IMPLICIT_ACCESS);
- const GURL history_url = GURL("http://www.google.com");
- history_service->AddPage(history_url, history::SOURCE_BROWSED);
- string16 title;
- ASSERT_TRUE(UTF8ToUTF16("Google",
- 6,
- &title));
- history_service->SetPageTitle(history_url, title);
- WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUIHistoryURL,
- true);
-}
-#endif // OS_WIN
-
-IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestAboutPageLTR) {
- RunBidiCheckerOnPage(chrome::kChromeUIAboutURL, false);
+IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestAboutPageLTR) {\
+ RunBidiCheckerOnPage(chrome::kChromeUIAboutURL, false);\
}
// Times out. http://code.google.com/p/chromium/issues/detail?id=82896
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest,
- DISABLED_TestBookmarksPageLTR) {
- RunBidiCheckerOnPage(chrome::kChromeUIBookmarksURL, false);
-}
-
-#ifndef OS_WIN
-// Times out. http://code.google.com/p/chromium/issues/detail?id=82896
-IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi,
- DISABLED_TestBookmarksPageRTL) {
- WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(
- chrome::kChromeUIBookmarksURL, true);
-}
-#endif // OS_WIN
-
-IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestBugReportPageLTR) {
- RunBidiCheckerOnPage(chrome::kChromeUIBugReportURL, false);
-}
-
-IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestCrashesPageLTR) {
- RunBidiCheckerOnPage(chrome::kChromeUICrashesURL, false);
+ DISABLED_TestBookmarksPageLTR) {\
+ RunBidiCheckerOnPage(chrome::kChromeUIBookmarksURL, false);\
}
-#ifndef OS_WIN
-IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi,
- TestCrashesPageRTL) {
- WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUICrashesURL,
- true);
+IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestBugReportPageLTR) {\
+ RunBidiCheckerOnPage(chrome::kChromeUIBugReportURL, false);\
}
-#endif // OS_WIN
-IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestDownloadsPageLTR) {
- RunBidiCheckerOnPage(chrome::kChromeUIDownloadsURL, false);
+IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestCrashesPageLTR) {\
+ RunBidiCheckerOnPage(chrome::kChromeUICrashesURL, false);\
}
-#ifndef OS_WIN
-IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi,
- TestDownloadsPageRTL) {
- WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(
- chrome::kChromeUIDownloadsURL, true);
+IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestDownloadsPageLTR) {\
+ RunBidiCheckerOnPage(chrome::kChromeUIDownloadsURL, false);\
}
-#endif // OS_WIN
-IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestNewTabPageLTR) {
- RunBidiCheckerOnPage(chrome::kChromeUINewTabURL, false);
+IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestNewTabPageLTR) {\
+ RunBidiCheckerOnPage(chrome::kChromeUINewTabURL, false);\
}
-#ifndef OS_WIN
-IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, TestNewTabPageRTL) {
- WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUINewTabURL,
- true);
+IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestPluginsPageLTR) {\
+ RunBidiCheckerOnPage(chrome::kChromeUIPluginsURL, false);\
}
-#endif // OS_WIN
-IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestPluginsPageLTR) {
- RunBidiCheckerOnPage(chrome::kChromeUIPluginsURL, false);
+IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestSettingsPageLTR) {\
+ RunBidiCheckerOnPage(chrome::kChromeUISettingsURL, false);\
}
-#ifndef OS_WIN
-IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi,
- TestPluginsPageRTL) {
- WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUIPluginsURL,
- true);
-}
-#endif // OS_WIN
-
-IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestSettingsPageLTR) {
- RunBidiCheckerOnPage(chrome::kChromeUISettingsURL, false);
-}
-
-#ifndef OS_WIN
-IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi,
- TestSettingsPageRTL) {
- WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(
- chrome::kChromeUISettingsURL, true);
-}
-#endif // OS_WIN
-
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest,
TestSettingsAutofillPageLTR) {
std::string url(chrome::kChromeUISettingsURL);
@@ -223,37 +128,3 @@ IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest,
RunBidiCheckerOnPage(url.c_str(), false);
}
-
-#ifndef OS_WIN
-IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi,
- TestSettingsAutofillPageRTL) {
- std::string url(chrome::kChromeUISettingsURL);
- url += std::string(chrome::kAutofillSubPage);
-
- autofill_test::DisableSystemServices(browser()->profile());
- AutofillProfile profile;
- autofill_test::SetProfileInfo(
- &profile,
- "Milton",
- "C.",
- "Waddams",
- "red.swingline@initech.com",
- "Initech",
- "4120 Freidrich Lane",
- "Basement",
- "Austin",
- "Texas",
- "78744",
- "United States",
- "5125551234",
- "5125550000");
-
- PersonalDataManager* personal_data_manager =
- browser()->profile()->GetPersonalDataManager();
- ASSERT_TRUE(personal_data_manager);
-
- personal_data_manager->AddProfile(profile);
-
- WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(url.c_str(), true);
-}
-#endif // OS_WIN
diff --git a/chrome/browser/ui/webui/BidiCheckerWebUITest.h b/chrome/browser/ui/webui/BidiCheckerWebUITest.h
index a1ac7b6..f522471 100644
--- a/chrome/browser/ui/webui/BidiCheckerWebUITest.h
+++ b/chrome/browser/ui/webui/BidiCheckerWebUITest.h
@@ -16,7 +16,7 @@ class WebUIBidiCheckerBrowserTest : public WebUIBrowserTest {
virtual ~WebUIBidiCheckerBrowserTest();
// Runs the Bidi Checker on the given page URL. |isRTL| should be true when
- // the active page locale is RTL.
+ // the active page locale of the page is RTL.
void RunBidiCheckerOnPage(const char pageURL[], bool isRTL);
protected:
@@ -26,20 +26,4 @@ class WebUIBidiCheckerBrowserTest : public WebUIBrowserTest {
virtual void SetUpInProcessBrowserTestFixture();
};
-// TODO(ofri): Add support for fake bidi on Windows
-#ifndef OS_WIN
-// Base class for BidiChecker-based tests that run with an RTL UI.
-// Preloads the BidiChecker JS library for each test, as well as modifies the
-// active language.
-class WebUIBidiCheckerBrowserTestFakeBidi : public WebUIBidiCheckerBrowserTest {
- public:
- virtual ~WebUIBidiCheckerBrowserTestFakeBidi();
-
- protected:
- WebUIBidiCheckerBrowserTestFakeBidi();
- virtual void SetUpInProcessBrowserTestFixture();
- virtual void TearDownInProcessBrowserTestFixture();
-};
-#endif // OS_WIN
-
#endif // CHROME_BROWSER_UI_WEBUI_BIDICHECKERWEBUITEST_H_
diff --git a/chrome/test/data/webui/bidichecker_tests.js b/chrome/test/data/webui/bidichecker_tests.js
index 182eceb..84f4a32 100644
--- a/chrome/test/data/webui/bidichecker_tests.js
+++ b/chrome/test/data/webui/bidichecker_tests.js
@@ -25,31 +25,12 @@ function filtersForPage(pageName, isRTL) {
],
// Filters for RTL UI
"RTL" : [
- // BUG: http://code.google.com/p/chromium/issues/detail?id=80791
- bidichecker.FilterFactory.atText("Google")
]
},
"chrome://settings/autofill" : {
"LTR" : [
// BUG: http://code.google.com/p/chromium/issues/detail?id=82267
bidichecker.FilterFactory.atText("משה ב כהן, דרך מנחם בגין")
- ],
- "RTL" : [
- // BUG: http://code.google.com/p/chromium/issues/detail?id=90322
- bidichecker.FilterFactory.atText(
- "Milton C. Waddams, 4120 Freidrich Lane")
- ]
- },
- "chrome://plugins" : {
- "RTL" : [
- // False positive
- bidichecker.FilterFactory.atText("x")
- ]
- },
- "chrome://newtab/" : {
- "RTL" : [
- // BUG: http://code.google.com/p/chromium/issues/detail?id=93339
- bidichecker.FilterFactory.atText("Chrome Web Store")
]
}
};
diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc
index c47b7b9..8322566 100644
--- a/ui/base/resource/resource_bundle.cc
+++ b/ui/base/resource/resource_bundle.cc
@@ -4,7 +4,6 @@
#include "ui/base/resource/resource_bundle.h"
-#include "base/command_line.h"
#include "base/logging.h"
#include "base/stl_util.h"
#include "base/string_piece.h"
@@ -12,7 +11,6 @@
#include "build/build_config.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/resource/data_pack.h"
-#include "ui/base/ui_base_switches.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/font.h"
#include "ui/gfx/image/image.h"
@@ -104,14 +102,6 @@ ResourceBundle& ResourceBundle::GetSharedInstance() {
return *g_shared_instance_;
}
-void ResourceBundle::OverrideLocalePak(FilePath pak_path) {
- overridden_pak_path_ = pak_path;
-}
-
-FilePath& ResourceBundle::GetOverriddenPakPath() {
- return overridden_pak_path_;
-}
-
SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) {
const SkBitmap* bitmap =
static_cast<const SkBitmap*>(GetImageNamed(resource_id));
@@ -206,11 +196,6 @@ ResourceBundle::ResourceBundle()
resources_data_(NULL),
large_icon_resources_data_(NULL),
locale_resources_data_(NULL) {
- CommandLine *command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kLocalePak)) {
- OverrideLocalePak(
- command_line->GetSwitchValuePath(switches::kLocalePak));
- }
}
void ResourceBundle::FreeImages() {
diff --git a/ui/base/resource/resource_bundle.h b/ui/base/resource/resource_bundle.h
index f10af62..37d3ef1 100644
--- a/ui/base/resource/resource_bundle.h
+++ b/ui/base/resource/resource_bundle.h
@@ -142,11 +142,6 @@ class UI_EXPORT ResourceBundle {
// system have changed, for example, when the locale has changed.
void ReloadFonts();
- // Overrides the path to the pak file from which the locale resources will be
- // loaded. Pass an empty path to undo.
- void OverrideLocalePak(FilePath pak_path);
- FilePath& GetOverriddenPakPath();
-
#if defined(OS_WIN)
// NOTE: This needs to be called before initializing the shared instance if
// your resources are not stored in the executable.
@@ -298,8 +293,6 @@ class UI_EXPORT ResourceBundle {
static ResourceBundle* g_shared_instance_;
- FilePath overridden_pak_path_;
-
DISALLOW_COPY_AND_ASSIGN(ResourceBundle);
};
diff --git a/ui/base/resource/resource_bundle_posix.cc b/ui/base/resource/resource_bundle_posix.cc
index df6ff93..d23a5b1 100644
--- a/ui/base/resource/resource_bundle_posix.cc
+++ b/ui/base/resource/resource_bundle_posix.cc
@@ -4,6 +4,7 @@
#include "ui/base/resource/resource_bundle.h"
+#include "base/command_line.h"
#include "base/file_path.h"
#include "base/logging.h"
#include "base/stl_util.h"
@@ -12,6 +13,7 @@
#include "base/synchronization/lock.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/data_pack.h"
+#include "ui/base/ui_base_switches.h"
#include "ui/gfx/font.h"
namespace ui {
@@ -113,8 +115,12 @@ std::string ResourceBundle::LoadLocaleResources(
const std::string& pref_locale) {
DCHECK(!locale_resources_data_) << "locale.pak already loaded";
std::string app_locale = l10n_util::GetApplicationLocale(pref_locale);
- FilePath locale_file_path = GetOverriddenPakPath();
- if (locale_file_path.empty()) {
+ FilePath locale_file_path;
+ CommandLine *command_line = CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kLocalePak)) {
+ locale_file_path =
+ command_line->GetSwitchValuePath(switches::kLocalePak);
+ } else {
locale_file_path = GetLocaleFilePath(app_locale);
}
if (locale_file_path.empty()) {