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

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

Issue 7621031: Revert 97049 - Trying to see if it fixes sync_integration_tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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"
13 #include "content/browser/browser_thread.h" 12 #include "content/browser/browser_thread.h"
14 13
15 // Base class which contains a valid Browser*. Lots of boilerplate to 14 // Base class which contains a valid Browser*. Lots of boilerplate to
16 // recycle between unit test classes. 15 // recycle between unit test classes.
17 // 16 //
18 // This class creates fake UI, file, and IO threads because many objects that 17 // This class creates fake UI, file, and IO threads because many objects that
19 // are attached to the TestingProfile (and other objects) have traits that limit 18 // are attached to the TestingProfile (and other objects) have traits that limit
20 // their destruction to certain threads. For example, the net::URLRequestContext 19 // their destruction to certain threads. For example, the net::URLRequestContext
21 // can only be deleted on the IO thread; without this fake IO thread, the object 20 // can only be deleted on the IO thread; without this fake IO thread, the object
22 // would never be deleted and would report as a leak under Valgrind. Note that 21 // would never be deleted and would report as a leak under Valgrind. Note that
23 // these are fake threads and they all share the same MessageLoop. 22 // these are fake threads and they all share the same MessageLoop.
24 // 23 //
25 // TODO(jrg): move up a level (chrome/browser/ui/cocoa --> 24 // TODO(jrg): move up a level (chrome/browser/ui/cocoa -->
26 // chrome/browser), and use in non-Mac unit tests such as 25 // chrome/browser), and use in non-Mac unit tests such as
27 // back_forward_menu_model_unittest.cc, 26 // back_forward_menu_model_unittest.cc,
28 // navigation_controller_unittest.cc, .. 27 // navigation_controller_unittest.cc, ..
29 class BrowserTestHelper { 28 class BrowserTestHelper {
30 public: 29 public:
31 BrowserTestHelper(); 30 BrowserTestHelper();
32 virtual ~BrowserTestHelper(); 31 virtual ~BrowserTestHelper();
33 32
34 virtual TestingProfile* profile() const; 33 virtual TestingProfile* profile() const;
35 Browser* browser() const { return browser_.get(); } 34 Browser* browser() const { return browser_.get(); }
36 TestingBrowserProcess* browser_process() {
37 return browser_process_.get();
38 }
39 35
40 // Creates the browser window. To close this window call |CloseBrowserWindow|. 36 // Creates the browser window. To close this window call |CloseBrowserWindow|.
41 // Do NOT call close directly on the window. 37 // Do NOT call close directly on the window.
42 BrowserWindow* CreateBrowserWindow(); 38 BrowserWindow* CreateBrowserWindow();
43 39
44 // Closes the window for this browser. This must only be called after 40 // Closes the window for this browser. This must only be called after
45 // CreateBrowserWindow(). 41 // CreateBrowserWindow().
46 void CloseBrowserWindow(); 42 void CloseBrowserWindow();
47 43
48 private: 44 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
53 ScopedTestingBrowserProcess browser_process_; 45 ScopedTestingBrowserProcess browser_process_;
54 46
55 TestingProfileManager* profile_manager_;
56 scoped_ptr<AvatarMenuModel::Item> profile_info_;
57
58 scoped_ptr<TestingProfile> profile_; 47 scoped_ptr<TestingProfile> profile_;
59 scoped_ptr<Browser> browser_; 48 scoped_ptr<Browser> browser_;
60 MessageLoopForUI message_loop_; 49 MessageLoopForUI message_loop_;
61 BrowserThread ui_thread_; 50 BrowserThread ui_thread_;
62 scoped_ptr<BrowserThread> file_thread_; 51 scoped_ptr<BrowserThread> file_thread_;
63 scoped_ptr<BrowserThread> io_thread_; 52 scoped_ptr<BrowserThread> io_thread_;
64 }; 53 };
65 54
66 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_TEST_HELPER_H_ 55 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_TEST_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.mm ('k') | chrome/browser/ui/cocoa/browser_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698