summaryrefslogtreecommitdiffstats
path: root/chrome/test/testing_profile.cc
diff options
context:
space:
mode:
authorlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-06 23:17:59 +0000
committerlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-06 23:17:59 +0000
commitfb9d1f424cfcc4d6967cc104299dc697f17b748e (patch)
tree324122237a921e4fb7e6c5ca7f28acfaabdd2dd1 /chrome/test/testing_profile.cc
parentf2e5eb9352fcb27bbc6af89c8f67a58fea0a30cf (diff)
downloadchromium_src-fb9d1f424cfcc4d6967cc104299dc697f17b748e.zip
chromium_src-fb9d1f424cfcc4d6967cc104299dc697f17b748e.tar.gz
chromium_src-fb9d1f424cfcc4d6967cc104299dc697f17b748e.tar.bz2
A large part of this change is adding the 1st unit test for TemplateURLFetcher.
Also did some refactoring of TemplateURLFetcher to allow for a future modification in which I make it able to start the load of TemplateURLModel and wait for that to finish before processing the fetched url. BUG=38475 TEST=unit_test --gtest_filter=TemplateURLFetcher* Review URL: http://codereview.chromium.org/3548017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61727 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/testing_profile.cc')
-rw-r--r--chrome/test/testing_profile.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc
index 359f64d..a7ad89a 100644
--- a/chrome/test/testing_profile.cc
+++ b/chrome/test/testing_profile.cc
@@ -29,6 +29,7 @@
#include "chrome/browser/net/gaia/token_service.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/prefs/browser_prefs.h"
+#include "chrome/browser/search_engines/template_url_fetcher.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sync/profile_sync_service_mock.h"
@@ -40,6 +41,7 @@
#include "chrome/test/testing_pref_service.h"
#include "net/base/cookie_monster.h"
#include "net/url_request/url_request_context.h"
+#include "net/url_request/url_request_unittest.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "webkit/database/database_tracker.h"
@@ -108,16 +110,6 @@ class BookmarkLoadObserver : public BookmarkModelObserver {
DISALLOW_COPY_AND_ASSIGN(BookmarkLoadObserver);
};
-// This context is used to assist testing the CookieMonster by providing a
-// valid CookieStore. This can probably be expanded to test other aspects of
-// the context as well.
-class TestURLRequestContext : public URLRequestContext {
- public:
- TestURLRequestContext() {
- cookie_store_ = new net::CookieMonster(NULL, NULL);
- }
-};
-
// Used to return a dummy context (normally the context is on the IO thread).
// The one here can be run on the main test thread. Note that this can lead to
// a leak if your test does not have a ChromeThread::IO in it because
@@ -311,8 +303,16 @@ void TestingProfile::BlockUntilBookmarkModelLoaded() {
DCHECK(bookmark_bar_model_->IsLoaded());
}
+void TestingProfile::CreateTemplateURLFetcher() {
+ template_url_fetcher_.reset(new TemplateURLFetcher(this));
+}
+
void TestingProfile::CreateTemplateURLModel() {
- template_url_model_.reset(new TemplateURLModel(this));
+ SetTemplateURLModel(new TemplateURLModel(this));
+}
+
+void TestingProfile::SetTemplateURLModel(TemplateURLModel* model) {
+ template_url_model_.reset(model);
}
void TestingProfile::UseThemeProvider(BrowserThemeProvider* theme_provider) {