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

Side by Side Diff: chrome/test/base/testing_profile.cc

Issue 10803026: Get content_browsertest working. I've added a simple test for now, and will convert the tests in sr… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: get it working on mac + linux, fix unittests crash, and fix unittest link error and add missing dep… Created 8 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
« no previous file with comments | « chrome/test/base/chrome_test_launcher.cc ('k') | chrome/test/base/ui_test_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/test/base/testing_profile.h" 5 #include "chrome/test/base/testing_profile.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "chrome/common/chrome_constants.h" 47 #include "chrome/common/chrome_constants.h"
48 #include "chrome/common/chrome_notification_types.h" 48 #include "chrome/common/chrome_notification_types.h"
49 #include "chrome/common/chrome_switches.h" 49 #include "chrome/common/chrome_switches.h"
50 #include "chrome/common/url_constants.h" 50 #include "chrome/common/url_constants.h"
51 #include "chrome/test/base/bookmark_load_observer.h" 51 #include "chrome/test/base/bookmark_load_observer.h"
52 #include "chrome/test/base/testing_pref_service.h" 52 #include "chrome/test/base/testing_pref_service.h"
53 #include "chrome/test/base/ui_test_utils.h" 53 #include "chrome/test/base/ui_test_utils.h"
54 #include "content/public/browser/browser_thread.h" 54 #include "content/public/browser/browser_thread.h"
55 #include "content/public/browser/notification_service.h" 55 #include "content/public/browser/notification_service.h"
56 #include "content/public/browser/render_process_host.h" 56 #include "content/public/browser/render_process_host.h"
57 #include "content/public/test/browser_test_utils.h"
57 #include "content/public/test/mock_resource_context.h" 58 #include "content/public/test/mock_resource_context.h"
58 #include "net/cookies/cookie_monster.h" 59 #include "net/cookies/cookie_monster.h"
59 #include "net/url_request/url_request_context.h" 60 #include "net/url_request/url_request_context.h"
60 #include "net/url_request/url_request_context_getter.h" 61 #include "net/url_request/url_request_context_getter.h"
61 #include "net/url_request/url_request_test_util.h" 62 #include "net/url_request/url_request_test_util.h"
62 #include "testing/gmock/include/gmock/gmock.h" 63 #include "testing/gmock/include/gmock/gmock.h"
63 64
64 #if defined(ENABLE_CONFIGURATION_POLICY) 65 #if defined(ENABLE_CONFIGURATION_POLICY)
65 #include "chrome/browser/policy/policy_service_impl.h" 66 #include "chrome/browser/policy/policy_service_impl.h"
66 #else 67 #else
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 void TestingProfile::CreateWebDataService() { 386 void TestingProfile::CreateWebDataService() {
386 WebDataServiceFactory::GetInstance()->SetTestingFactory( 387 WebDataServiceFactory::GetInstance()->SetTestingFactory(
387 this, BuildWebDataService); 388 this, BuildWebDataService);
388 } 389 }
389 390
390 void TestingProfile::BlockUntilBookmarkModelLoaded() { 391 void TestingProfile::BlockUntilBookmarkModelLoaded() {
391 DCHECK(GetBookmarkModel()); 392 DCHECK(GetBookmarkModel());
392 if (GetBookmarkModel()->IsLoaded()) 393 if (GetBookmarkModel()->IsLoaded())
393 return; 394 return;
394 base::RunLoop run_loop; 395 base::RunLoop run_loop;
395 BookmarkLoadObserver observer( 396 BookmarkLoadObserver observer(content::GetQuitTaskForRunLoop(&run_loop));
396 ui_test_utils::GetQuitTaskForRunLoop(&run_loop));
397 GetBookmarkModel()->AddObserver(&observer); 397 GetBookmarkModel()->AddObserver(&observer);
398 run_loop.Run(); 398 run_loop.Run();
399 GetBookmarkModel()->RemoveObserver(&observer); 399 GetBookmarkModel()->RemoveObserver(&observer);
400 DCHECK(GetBookmarkModel()->IsLoaded()); 400 DCHECK(GetBookmarkModel()->IsLoaded());
401 } 401 }
402 402
403 // TODO(phajdan.jr): Doesn't this hang if Top Sites are already loaded? 403 // TODO(phajdan.jr): Doesn't this hang if Top Sites are already loaded?
404 void TestingProfile::BlockUntilTopSitesLoaded() { 404 void TestingProfile::BlockUntilTopSitesLoaded() {
405 ui_test_utils::WindowedNotificationObserver top_sites_loaded_observer( 405 ui_test_utils::WindowedNotificationObserver top_sites_loaded_observer(
406 chrome::NOTIFICATION_TOP_SITES_LOADED, 406 chrome::NOTIFICATION_TOP_SITES_LOADED,
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 } 735 }
736 736
737 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { 737 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) {
738 return true; 738 return true;
739 } 739 }
740 740
741 base::Callback<ChromeURLDataManagerBackend*(void)> 741 base::Callback<ChromeURLDataManagerBackend*(void)>
742 TestingProfile::GetChromeURLDataManagerBackendGetter() const { 742 TestingProfile::GetChromeURLDataManagerBackendGetter() const {
743 return base::Callback<ChromeURLDataManagerBackend*(void)>(); 743 return base::Callback<ChromeURLDataManagerBackend*(void)>();
744 } 744 }
OLDNEW
« no previous file with comments | « chrome/test/base/chrome_test_launcher.cc ('k') | chrome/test/base/ui_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698