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

Side by Side Diff: chrome/browser/extensions/test_extension_environment.cc

Issue 23882007: Explicit initialization of aura::Env for browser shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased no-op Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/extensions/test_extension_environment.h" 5 #include "chrome/browser/extensions/test_extension_environment.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/test_extension_system.h" 12 #include "chrome/browser/extensions/test_extension_system.h"
13 #include "chrome/browser/sessions/session_tab_helper.h" 13 #include "chrome/browser/sessions/session_tab_helper.h"
14 #include "chrome/common/extensions/extension.h" 14 #include "chrome/common/extensions/extension.h"
15 #include "chrome/common/extensions/extension_builder.h" 15 #include "chrome/common/extensions/extension_builder.h"
16 #include "chrome/common/extensions/value_builder.h" 16 #include "chrome/common/extensions/value_builder.h"
17 #include "chrome/test/base/testing_profile.h" 17 #include "chrome/test/base/testing_profile.h"
18 #include "content/public/test/web_contents_tester.h" 18 #include "content/public/test/web_contents_tester.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 #if defined(USE_AURA)
22 #include "ui/aura/env.h"
23 #endif
24
21 namespace extensions { 25 namespace extensions {
22 26
23 using content::BrowserThread; 27 using content::BrowserThread;
24 28
25 TestExtensionEnvironment::TestExtensionEnvironment() 29 TestExtensionEnvironment::TestExtensionEnvironment()
26 : ui_thread_(BrowserThread::UI, &loop_), 30 : ui_thread_(BrowserThread::UI, &loop_),
27 file_thread_(BrowserThread::FILE), 31 file_thread_(BrowserThread::FILE),
28 file_blocking_thread_(BrowserThread::FILE_USER_BLOCKING), 32 file_blocking_thread_(BrowserThread::FILE_USER_BLOCKING),
29 io_thread_(BrowserThread::IO), 33 io_thread_(BrowserThread::IO),
30 profile_(new TestingProfile), 34 profile_(new TestingProfile),
31 extension_service_(NULL) { 35 extension_service_(NULL) {
32 file_thread_.Start(); 36 file_thread_.Start();
33 file_blocking_thread_.Start(); 37 file_blocking_thread_.Start();
34 io_thread_.StartIOThread(); 38 io_thread_.StartIOThread();
39
40 #if defined(USE_AURA)
41 aura::Env::CreateInstance();
42 #endif
35 } 43 }
36 44
37 TestExtensionEnvironment::~TestExtensionEnvironment() { 45 TestExtensionEnvironment::~TestExtensionEnvironment() {
46 #if defined(USE_AURA)
47 aura::Env::DeleteInstance();
48 #endif
49
38 profile_.reset(); 50 profile_.reset();
39 // Delete the profile, and then cycle the message loop to clear 51 // Delete the profile, and then cycle the message loop to clear
40 // out delayed deletions. 52 // out delayed deletions.
41 base::RunLoop().RunUntilIdle(); 53 base::RunLoop().RunUntilIdle();
42 } 54 }
43 55
44 TestingProfile* TestExtensionEnvironment::profile() const { 56 TestingProfile* TestExtensionEnvironment::profile() const {
45 return profile_.get(); 57 return profile_.get();
46 } 58 }
47 59
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 91
80 scoped_ptr<content::WebContents> TestExtensionEnvironment::MakeTab() const { 92 scoped_ptr<content::WebContents> TestExtensionEnvironment::MakeTab() const {
81 scoped_ptr<content::WebContents> contents( 93 scoped_ptr<content::WebContents> contents(
82 content::WebContentsTester::CreateTestWebContents(profile(), NULL)); 94 content::WebContentsTester::CreateTestWebContents(profile(), NULL));
83 // Create a tab id. 95 // Create a tab id.
84 SessionTabHelper::CreateForWebContents(contents.get()); 96 SessionTabHelper::CreateForWebContents(contents.get());
85 return contents.Pass(); 97 return contents.Pass();
86 } 98 }
87 99
88 } // namespace extensions 100 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698