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

Side by Side Diff: chrome/browser/ui/cocoa/browser_test_helper.h

Issue 7648037: [Mac] Flip the flag for multi-profiles to on by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Un-needed includes Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_TEST_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_TEST_HELPER_H_
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_TEST_HELPER_H_ 6 #define CHROME_BROWSER_UI_COCOA_BROWSER_TEST_HELPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/test/base/testing_browser_process.h" 10 #include "chrome/test/base/testing_browser_process.h"
11 #include "chrome/test/base/testing_profile.h" 11 #include "chrome/test/base/testing_profile.h"
12 #include "chrome/test/base/testing_profile_manager.h"
12 #include "content/browser/browser_thread.h" 13 #include "content/browser/browser_thread.h"
13 14
14 // Base class which contains a valid Browser*. Lots of boilerplate to 15 // Base class which contains a valid Browser*. Lots of boilerplate to
15 // recycle between unit test classes. 16 // recycle between unit test classes.
16 // 17 //
17 // This class creates fake UI, file, and IO threads because many objects that 18 // This class creates fake UI, file, and IO threads because many objects that
18 // are attached to the TestingProfile (and other objects) have traits that limit 19 // are attached to the TestingProfile (and other objects) have traits that limit
19 // their destruction to certain threads. For example, the net::URLRequestContext 20 // their destruction to certain threads. For example, the net::URLRequestContext
20 // can only be deleted on the IO thread; without this fake IO thread, the object 21 // can only be deleted on the IO thread; without this fake IO thread, the object
21 // would never be deleted and would report as a leak under Valgrind. Note that 22 // would never be deleted and would report as a leak under Valgrind. Note that
22 // these are fake threads and they all share the same MessageLoop. 23 // these are fake threads and they all share the same MessageLoop.
23 // 24 //
24 // TODO(jrg): move up a level (chrome/browser/ui/cocoa --> 25 // TODO(jrg): move up a level (chrome/browser/ui/cocoa -->
25 // chrome/browser), and use in non-Mac unit tests such as 26 // chrome/browser), and use in non-Mac unit tests such as
26 // back_forward_menu_model_unittest.cc, 27 // back_forward_menu_model_unittest.cc,
27 // navigation_controller_unittest.cc, .. 28 // navigation_controller_unittest.cc, ..
28 class BrowserTestHelper { 29 class BrowserTestHelper {
29 public: 30 public:
30 BrowserTestHelper(); 31 BrowserTestHelper();
31 virtual ~BrowserTestHelper(); 32 virtual ~BrowserTestHelper();
32 33
33 virtual TestingProfile* profile() const; 34 virtual TestingProfile* profile() const;
34 Browser* browser() const { return browser_.get(); } 35 Browser* browser() const { return browser_.get(); }
36 TestingBrowserProcess* browser_process() {
37 return browser_process_.get();
38 }
35 39
36 // Creates the browser window. To close this window call |CloseBrowserWindow|. 40 // Creates the browser window. To close this window call |CloseBrowserWindow|.
37 // Do NOT call close directly on the window. 41 // Do NOT call close directly on the window.
38 BrowserWindow* CreateBrowserWindow(); 42 BrowserWindow* CreateBrowserWindow();
39 43
40 // Closes the window for this browser. This must only be called after 44 // Closes the window for this browser. This must only be called after
41 // CreateBrowserWindow(). 45 // CreateBrowserWindow().
42 void CloseBrowserWindow(); 46 void CloseBrowserWindow();
43 47
44 private: 48 private:
49 // Code that will relies on g_browser_process->profile_manager() needs special
50 // setup. This performs that setup now that multiprofiles is enabled.
51 void SetUpProfileManager();
52
45 ScopedTestingBrowserProcess browser_process_; 53 ScopedTestingBrowserProcess browser_process_;
46 54
55 TestingProfileManager* profile_manager_;
56 scoped_ptr<AvatarMenuModel::Item> profile_info_;
57
47 scoped_ptr<TestingProfile> profile_; 58 scoped_ptr<TestingProfile> profile_;
48 scoped_ptr<Browser> browser_; 59 scoped_ptr<Browser> browser_;
49 MessageLoopForUI message_loop_; 60 MessageLoopForUI message_loop_;
50 BrowserThread ui_thread_; 61 BrowserThread ui_thread_;
51 scoped_ptr<BrowserThread> file_thread_; 62 scoped_ptr<BrowserThread> file_thread_;
52 scoped_ptr<BrowserThread> io_thread_; 63 scoped_ptr<BrowserThread> io_thread_;
53 }; 64 };
54 65
55 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_TEST_HELPER_H_ 66 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_TEST_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698