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

Side by Side Diff: chrome/browser/search_engines/template_url_service_test_util.h

Issue 17127002: Correctly integrate StoragePartition into TestingProfile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments. merge to ToT. Murder a DB thread and more TestBrowserThreads. Created 7 years, 5 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 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_ 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_ 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "chrome/browser/search_engines/template_url_service_observer.h" 16 #include "chrome/browser/search_engines/template_url_service_observer.h"
17 #include "chrome/test/base/testing_browser_process.h" 17 #include "chrome/test/base/testing_browser_process.h"
18 #include "content/public/test/test_browser_thread.h" 18 #include "content/public/test/test_browser_thread_bundle.h"
19 19
20 class GURL; 20 class GURL;
21 class TemplateURLService; 21 class TemplateURLService;
22 class TestingProfile; 22 class TestingProfile;
23 class TestingTemplateURLService; 23 class TestingTemplateURLService;
24 class TestingProfile; 24 class TestingProfile;
25 class WebDataService; 25 class WebDataService;
26 26
27 // Implements functionality to make it easier to test TemplateURLService and 27 // Implements functionality to make it easier to test TemplateURLService and
28 // make changes to it. 28 // make changes to it.
(...skipping 13 matching lines...) Expand all
42 42
43 // TemplateURLServiceObserver implemementation. 43 // TemplateURLServiceObserver implemementation.
44 virtual void OnTemplateURLServiceChanged() OVERRIDE; 44 virtual void OnTemplateURLServiceChanged() OVERRIDE;
45 45
46 // Gets the observer count. 46 // Gets the observer count.
47 int GetObserverCount(); 47 int GetObserverCount();
48 48
49 // Sets the observer count to 0. 49 // Sets the observer count to 0.
50 void ResetObserverCount(); 50 void ResetObserverCount();
51 51
52 // Blocks the caller until the service has finished servicing all pending
53 // requests.
54 static void BlockTillServiceProcessesRequests();
55
56 // Blocks the caller until the I/O thread has finished servicing all pending
57 // requests.
58 static void BlockTillIOThreadProcessesRequests();
59
60 // Makes sure the load was successful and sent the correct notification. 52 // Makes sure the load was successful and sent the correct notification.
61 void VerifyLoad(); 53 void VerifyLoad();
62 54
63 // Makes the model believe it has been loaded (without actually doing the 55 // Makes the model believe it has been loaded (without actually doing the
64 // load). Since this avoids setting the built-in keyword version, the next 56 // load). Since this avoids setting the built-in keyword version, the next
65 // load will do a merge from prepopulated data. 57 // load will do a merge from prepopulated data.
66 void ChangeModelToLoadState(); 58 void ChangeModelToLoadState();
67 59
68 // Deletes the current model (and doesn't create a new one). 60 // Deletes the current model (and doesn't create a new one).
69 void ClearModel(); 61 void ClearModel();
(...skipping 25 matching lines...) Expand all
95 // Remove all the managed preferences for the default search provider and 87 // Remove all the managed preferences for the default search provider and
96 // trigger notification. 88 // trigger notification.
97 void RemoveManagedDefaultSearchPreferences(); 89 void RemoveManagedDefaultSearchPreferences();
98 90
99 // Returns the TemplateURLService. 91 // Returns the TemplateURLService.
100 TemplateURLService* model() const; 92 TemplateURLService* model() const;
101 93
102 // Returns the TestingProfile. 94 // Returns the TestingProfile.
103 TestingProfile* profile() const; 95 TestingProfile* profile() const;
104 96
105 // Starts an I/O thread.
106 void StartIOThread();
107
108 // Runs all pending tasks on the UI loop.
109 void PumpLoop();
110
111 private: 97 private:
112 base::MessageLoopForUI message_loop_;
113 // Needed to make the DeleteOnUIThread trait of WebDataService work 98 // Needed to make the DeleteOnUIThread trait of WebDataService work
114 // properly. 99 // properly.
115 content::TestBrowserThread ui_thread_; 100 content::TestBrowserThreadBundle thread_bundle_;
116 content::TestBrowserThread db_thread_;
117 content::TestBrowserThread io_thread_;
118 scoped_ptr<TestingProfile> profile_; 101 scoped_ptr<TestingProfile> profile_;
119 int changed_count_; 102 int changed_count_;
120 base::ScopedTempDir temp_dir_; 103 base::ScopedTempDir temp_dir_;
121 104
122 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceTestUtil); 105 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceTestUtil);
123 }; 106 };
124 107
125 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_ 108 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698