summaryrefslogtreecommitdiffstats
path: root/components/html_viewer
diff options
context:
space:
mode:
authorjam <jam@chromium.org>2015-11-30 09:54:39 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-30 17:55:20 +0000
commitbfab778c21d4cb4656dc03205662cddf84ee4ac7 (patch)
treef9fde7e58a012dbdb1565ea33c38d95220066d69 /components/html_viewer
parent6bbab2e51655e7383929305389734fe77e8217a0 (diff)
downloadchromium_src-bfab778c21d4cb4656dc03205662cddf84ee4ac7.zip
chromium_src-bfab778c21d4cb4656dc03205662cddf84ee4ac7.tar.gz
chromium_src-bfab778c21d4cb4656dc03205662cddf84ee4ac7.tar.bz2
Remove SimpleBroker and instead use the production broker implementation in tests.
Now that we'll be using the broker for non-sandbox communication, all processes need to share state. This is better anyways to exercise the production code in tests. BUG=561803 Review URL: https://codereview.chromium.org/1485573002 Cr-Commit-Position: refs/heads/master@{#362157}
Diffstat (limited to 'components/html_viewer')
-rw-r--r--components/html_viewer/run_all_unittests.cc50
1 files changed, 16 insertions, 34 deletions
diff --git a/components/html_viewer/run_all_unittests.cc b/components/html_viewer/run_all_unittests.cc
index 9a208e1..134c51e 100644
--- a/components/html_viewer/run_all_unittests.cc
+++ b/components/html_viewer/run_all_unittests.cc
@@ -30,48 +30,30 @@ std::vector<gfx::Display> GetTestDisplays() {
return displays;
}
-class NoAtExitBaseTestSuite : public base::TestSuite {
- public:
- NoAtExitBaseTestSuite(int argc, char** argv)
- : base::TestSuite(argc, argv, false), ui_init_(GetTestDisplays()) {
-#if defined(OS_ANDROID)
- base::MemoryMappedFile::Region resource_file_region;
- int fd = base::android::OpenApkAsset("assets/html_viewer.pak",
- &resource_file_region);
- CHECK_NE(fd, -1);
- ui::ResourceBundle::InitSharedInstanceWithPakPath(base::FilePath());
- ui::ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion(
- base::File(fd), resource_file_region, ui::SCALE_FACTOR_100P);
-#else
- base::FilePath pak_path;
- CHECK(PathService::Get(base::DIR_MODULE, &pak_path));
- pak_path = pak_path.AppendASCII("html_viewer.pak");
- ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_path);
-#endif
- }
-
- private:
- ui::mojo::UIInit ui_init_;
-
- DISALLOW_COPY_AND_ASSIGN(NoAtExitBaseTestSuite);
-};
-
-int RunTestSuite(int argc, char** argv) {
- return NoAtExitBaseTestSuite(argc, argv).Run();
-}
-
} // namespace
int main(int argc, char** argv) {
+ base::TestSuite test_suite(argc, argv);
#if defined(OS_ANDROID)
JNIEnv* env = base::android::AttachCurrentThread();
base::RegisterContentUriTestUtils(env);
+ base::MemoryMappedFile::Region resource_file_region;
+ int fd = base::android::OpenApkAsset("assets/html_viewer.pak",
+ &resource_file_region);
+ CHECK_NE(fd, -1);
+ ui::ResourceBundle::InitSharedInstanceWithPakPath(base::FilePath());
+ ui::ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion(
+ base::File(fd), resource_file_region, ui::SCALE_FACTOR_100P);
#else
- base::AtExitManager at_exit;
+ base::FilePath pak_path;
+ CHECK(PathService::Get(base::DIR_MODULE, &pak_path));
+ pak_path = pak_path.AppendASCII("html_viewer.pak");
+ ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_path);
#endif
+ ui::mojo::UIInit ui_init(GetTestDisplays());
mojo::embedder::Init();
- return base::LaunchUnitTests(argc,
- argv,
- base::Bind(&RunTestSuite, argc, argv));
+ return base::LaunchUnitTests(
+ argc, argv,
+ base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite)));
}