Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: ui/wm/test/run_all_unittests.cc

Issue 1293013002: aura: Require explicit ownership of the Env instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/test/launcher/unit_test_launcher.h" 9 #include "base/test/launcher/unit_test_launcher.h"
10 #include "base/test/test_suite.h" 10 #include "base/test/test_suite.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/aura/env.h"
12 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
13 #include "ui/base/ui_base_paths.h" 14 #include "ui/base/ui_base_paths.h"
14 #include "ui/gl/test/gl_surface_test_support.h" 15 #include "ui/gl/test/gl_surface_test_support.h"
15 16
16 class WMTestSuite : public base::TestSuite { 17 class WMTestSuite : public base::TestSuite {
17 public: 18 public:
18 WMTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} 19 WMTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {}
19 20
20 protected: 21 protected:
21 void Initialize() override { 22 void Initialize() override {
22 base::TestSuite::Initialize(); 23 base::TestSuite::Initialize();
23 gfx::GLSurfaceTestSupport::InitializeOneOff(); 24 gfx::GLSurfaceTestSupport::InitializeOneOff();
24 ui::RegisterPathProvider(); 25 ui::RegisterPathProvider();
25 26
26 base::FilePath ui_test_pak_path; 27 base::FilePath ui_test_pak_path;
27 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); 28 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
28 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); 29 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
30
31 env_ = aura::Env::CreateInstance();
29 } 32 }
30 33
31 void Shutdown() override { 34 void Shutdown() override {
35 env_.reset();
32 ui::ResourceBundle::CleanupSharedInstance(); 36 ui::ResourceBundle::CleanupSharedInstance();
33 base::TestSuite::Shutdown(); 37 base::TestSuite::Shutdown();
34 } 38 }
35 39
36 private: 40 private:
41 scoped_ptr<aura::Env> env_;
37 DISALLOW_COPY_AND_ASSIGN(WMTestSuite); 42 DISALLOW_COPY_AND_ASSIGN(WMTestSuite);
38 }; 43 };
39 44
40 int main(int argc, char** argv) { 45 int main(int argc, char** argv) {
41 WMTestSuite test_suite(argc, argv); 46 WMTestSuite test_suite(argc, argv);
42 47
43 return base::LaunchUnitTests( 48 return base::LaunchUnitTests(
44 argc, argv, base::Bind(&WMTestSuite::Run, base::Unretained(&test_suite))); 49 argc, argv, base::Bind(&WMTestSuite::Run, base::Unretained(&test_suite)));
45 } 50 }
OLDNEW
« no previous file with comments | « ui/views_content_client/views_content_client_main_parts_desktop_aura.cc ('k') | ui/wm/test/wm_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698