summaryrefslogtreecommitdiffstats
path: root/ash/test
diff options
context:
space:
mode:
authormsw <msw@chromium.org>2016-02-09 16:26:16 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-10 00:27:47 +0000
commit40ddaa81f4e1e88439377986ce5c268afdf16e1d (patch)
treec5a2442e279040baf64c11ae2622db7e37e95a76 /ash/test
parent382da786010fc309637e9afba4593ff65ae46e34 (diff)
downloadchromium_src-40ddaa81f4e1e88439377986ce5c268afdf16e1d.zip
chromium_src-40ddaa81f4e1e88439377986ce5c268afdf16e1d.tar.gz
chromium_src-40ddaa81f4e1e88439377986ce5c268afdf16e1d.tar.bz2
Support building ash targets with use_ash=0 and use_aura=1.
Support building/running ash_unittests and ash_shell_with_content. Change some build |use_ash| checks to |use_aura| (or remove them). Avoid the unspecified ash dependency on chrome resources! Explicitly load new ash_test_*.pak image/string resources instead. (avoids including ash_resources in chrome paks w/use_aura builds) Reserve more resource IDs for ash_strings to avoid overlap. (uses 244 IDs now; reserve 300 instead of 200 to fit existing) Reserve fewer content shell resource IDs, to avoid exceeding 3100. (uses 4 IDs now; reserve 150 instead of 250 to keep current total) https://code.google.com/p/chromium/codesearch#chromium/src/out/Debug/gen/content/shell/grit/shell_resources.h Use base::i18n::GetConfiguredLocale(), in several ash_unittests. (l10n_util::GetApplicationLocale fails IsLocaleAvailable('en-US')) (because it's not loading the chrome locale data anymore) (seems okay to pair with base::i18n::SetICUDefaultLocale) TODO: Fix ash_unittests failures/crahes (repros on ToT w/use_ash). TODO: Fix ash_shell_with_content crash (repros on ToT w/use_ash). TODO: Load ash resources; not 'common' in ash_shell_with_content. TODO: Exclude ash files from message_center crbug.com/585175. TODO: Support ash_test_resources_300_percent.pak, etc.? BUG=584038,585175 TEST=Building ash_unittests and ash_shell_with_content works with use_ash=0 and use_aura=1. R=oshima@chromium.org,dewittj@chromium.org,sky@chromium.org TBR=jam@chromium.org Review URL: https://codereview.chromium.org/1664013002 Cr-Commit-Position: refs/heads/master@{#374547}
Diffstat (limited to 'ash/test')
-rw-r--r--ash/test/test_suite.cc25
1 files changed, 21 insertions, 4 deletions
diff --git a/ash/test/test_suite.cc b/ash/test/test_suite.cc
index 8e2db6d..c4f6c03 100644
--- a/ash/test/test_suite.cc
+++ b/ash/test/test_suite.cc
@@ -7,6 +7,8 @@
#include "ash/ash_switches.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
+#include "base/i18n/rtl.h"
+#include "base/path_service.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/env.h"
@@ -49,10 +51,25 @@ void AuraShellTestSuite::Initialize() {
gfx::RegisterPathProvider();
ui::RegisterPathProvider();
- // Force unittests to run using en-US so if we test against string
- // output, it'll pass regardless of the system language.
- ui::ResourceBundle::InitSharedInstanceWithLocale(
- "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES);
+ // Force unittests to run using en-US so if we test against string output,
+ // it'll pass regardless of the system language.
+ base::i18n::SetICUDefaultLocale("en_US");
+
+ // Load ash resources and en-US strings; not 'common' (Chrome) resources.
+ // TODO(msw): Check ResourceBundle::IsScaleFactorSupported; load 300% etc.
+ base::FilePath path;
+ PathService::Get(base::DIR_MODULE, &path);
+ base::FilePath ash_test_strings =
+ path.Append(FILE_PATH_LITERAL("ash_test_strings.pak"));
+ base::FilePath ash_test_resources_100 =
+ path.Append(FILE_PATH_LITERAL("ash_test_resources_100_percent.pak"));
+ base::FilePath ash_test_resources_200 =
+ path.Append(FILE_PATH_LITERAL("ash_test_resources_200_percent.pak"));
+
+ ui::ResourceBundle::InitSharedInstanceWithPakPath(ash_test_strings);
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ rb.AddDataPackFromPath(ash_test_resources_100, ui::SCALE_FACTOR_100P);
+ rb.AddDataPackFromPath(ash_test_resources_200, ui::SCALE_FACTOR_200P);
base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_);
aura::Env::CreateInstance(true);