Commit f5d93c0e authored by pkotwicz@chromium.org's avatar pkotwicz@chromium.org

Make athena_unittests pass if the chrome executable is not built

BUG=None
TEST=None

Review URL: https://codereview.chromium.org/420663004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285703 0039d316-1c4b-4281-b951-d872f2087c98
parent d38a0110
...@@ -62,9 +62,9 @@ ...@@ -62,9 +62,9 @@
'../../ui/aura/aura.gyp:aura', '../../ui/aura/aura.gyp:aura',
'../../ui/compositor/compositor.gyp:compositor_test_support', '../../ui/compositor/compositor.gyp:compositor_test_support',
'../../ui/gfx/gfx.gyp:gfx', '../../ui/gfx/gfx.gyp:gfx',
'../../ui/resources/ui_resources.gyp:ui_test_pak',
'../athena.gyp:athena_lib', '../athena.gyp:athena_lib',
'../athena.gyp:athena_test_support', '../athena.gyp:athena_test_support',
'../resources/athena_resources.gyp:athena_pak',
], ],
'sources': [ 'sources': [
'athena_shell.cc', 'athena_shell.cc',
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "athena/activity/public/activity_manager.h" #include "athena/activity/public/activity_manager.h"
#include "athena/test/athena_test_helper.h" #include "athena/test/athena_test_helper.h"
#include "base/at_exit.h" #include "base/at_exit.h"
#include "base/base_paths.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/i18n/icu_util.h" #include "base/i18n/icu_util.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
...@@ -13,7 +14,6 @@ ...@@ -13,7 +14,6 @@
#include "base/run_loop.h" #include "base/run_loop.h"
#include "ui/aura/window_tree_host.h" #include "ui/aura/window_tree_host.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h"
#include "ui/compositor/test/context_factories_for_test.h" #include "ui/compositor/test/context_factories_for_test.h"
#include "ui/gl/gl_surface.h" #include "ui/gl/gl_surface.h"
...@@ -46,14 +46,14 @@ int main(int argc, const char **argv) { ...@@ -46,14 +46,14 @@ int main(int argc, const char **argv) {
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
base::AtExitManager exit_manager; base::AtExitManager exit_manager;
ui::RegisterPathProvider();
base::CommandLine::Init(argc, argv); base::CommandLine::Init(argc, argv);
base::i18n::InitializeICU(); base::i18n::InitializeICU();
gfx::GLSurface::InitializeOneOffForTests(); gfx::GLSurface::InitializeOneOffForTests();
base::FilePath ui_test_pak_path; base::FilePath test_pak_path;
DCHECK(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); CHECK(PathService::Get(base::DIR_MODULE, &test_pak_path));
ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); test_pak_path = test_pak_path.AppendASCII("athena_resources.pak");
ui::ResourceBundle::InitSharedInstanceWithPakPath(test_pak_path);
base::MessageLoopForUI message_loop; base::MessageLoopForUI message_loop;
UIShell shell(&message_loop); UIShell shell(&message_loop);
......
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "base/base_paths.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/path_service.h"
#include "base/test/launcher/unit_test_launcher.h" #include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h" #include "base/test/test_suite.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -27,9 +29,10 @@ class AthenaTestSuite : public base::TestSuite { ...@@ -27,9 +29,10 @@ class AthenaTestSuite : public base::TestSuite {
gfx::RegisterPathProvider(); gfx::RegisterPathProvider();
ui::RegisterPathProvider(); ui::RegisterPathProvider();
// Force unittests to run using en-US so if we test against string base::FilePath test_pak_path;
// output, it'll pass regardless of the system language. ASSERT_TRUE(PathService::Get(base::DIR_MODULE, &test_pak_path));
ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); test_pak_path = test_pak_path.AppendASCII("athena_resources.pak");
ui::ResourceBundle::InitSharedInstanceWithPakPath(test_pak_path);
} }
virtual void Shutdown() OVERRIDE { virtual void Shutdown() OVERRIDE {
ui::ResourceBundle::CleanupSharedInstance(); ui::ResourceBundle::CleanupSharedInstance();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment