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

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator_browsertest.cc

Issue 11365181: Remove GetExtensionService from Profile. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: replace missing extension_system include Created 8 years 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
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/extensions/extension_browsertest.h" 9 #include "chrome/browser/extensions/extension_browsertest.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/extensions/extension_system.h"
11 #include "chrome/browser/first_run/first_run.h" 12 #include "chrome/browser/first_run/first_run.h"
12 #include "chrome/browser/infobars/infobar_tab_helper.h" 13 #include "chrome/browser/infobars/infobar_tab_helper.h"
13 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/prefs/session_startup_pref.h" 15 #include "chrome/browser/prefs/session_startup_pref.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/profiles/profile_impl.h" 17 #include "chrome/browser/profiles/profile_impl.h"
17 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/sessions/session_restore.h" 19 #include "chrome/browser/sessions/session_restore.h"
19 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
20 #include "chrome/browser/ui/browser_finder.h" 21 #include "chrome/browser/ui/browser_finder.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #endif 58 #endif
58 } 59 }
59 60
60 // Helper functions return void so that we can ASSERT*(). 61 // Helper functions return void so that we can ASSERT*().
61 // Use ASSERT_NO_FATAL_FAILURE around calls to these functions to stop the 62 // Use ASSERT_NO_FATAL_FAILURE around calls to these functions to stop the
62 // test if an assert fails. 63 // test if an assert fails.
63 void LoadApp(const std::string& app_name, 64 void LoadApp(const std::string& app_name,
64 const Extension** out_app_extension) { 65 const Extension** out_app_extension) {
65 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII(app_name.c_str()))); 66 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII(app_name.c_str())));
66 67
67 ExtensionService* service = browser()->profile()->GetExtensionService(); 68 ExtensionService* service = extensions::ExtensionSystem::Get(
69 browser()->profile())->extension_service();
68 *out_app_extension = service->GetExtensionById( 70 *out_app_extension = service->GetExtensionById(
69 last_loaded_extension_id_, false); 71 last_loaded_extension_id_, false);
70 ASSERT_TRUE(*out_app_extension); 72 ASSERT_TRUE(*out_app_extension);
71 73
72 // Code that opens a new browser assumes we start with exactly one. 74 // Code that opens a new browser assumes we start with exactly one.
73 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile())); 75 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile()));
74 } 76 }
75 77
76 void SetAppLaunchPref(const std::string& app_id, 78 void SetAppLaunchPref(const std::string& app_id,
77 extensions::ExtensionPrefs::LaunchType launch_type) { 79 extensions::ExtensionPrefs::LaunchType launch_type) {
78 ExtensionService* service = browser()->profile()->GetExtensionService(); 80 ExtensionService* service = extensions::ExtensionSystem::Get(
81 browser()->profile())->extension_service();
79 service->extension_prefs()->SetLaunchType(app_id, launch_type); 82 service->extension_prefs()->SetLaunchType(app_id, launch_type);
80 } 83 }
81 84
82 // Check that there are two browsers. Find the one that is not |browser()|. 85 // Check that there are two browsers. Find the one that is not |browser()|.
83 void FindOneOtherBrowser(Browser** out_other_browser) { 86 void FindOneOtherBrowser(Browser** out_other_browser) {
84 // There should only be one other browser. 87 // There should only be one other browser.
85 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile())); 88 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile()));
86 89
87 // Find the new browser. 90 // Find the new browser.
88 Browser* other_browser = NULL; 91 Browser* other_browser = NULL;
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); 676 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL);
674 ASSERT_TRUE(new_browser); 677 ASSERT_TRUE(new_browser);
675 ASSERT_EQ(1, new_browser->tab_count()); 678 ASSERT_EQ(1, new_browser->tab_count());
676 web_contents = chrome::GetWebContentsAt(new_browser, 0); 679 web_contents = chrome::GetWebContentsAt(new_browser, 0);
677 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 680 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
678 web_contents->GetURL()); 681 web_contents->GetURL());
679 EXPECT_EQ(1U, InfoBarTabHelper::FromWebContents(web_contents)-> 682 EXPECT_EQ(1U, InfoBarTabHelper::FromWebContents(web_contents)->
680 GetInfoBarCount()); 683 GetInfoBarCount());
681 } 684 }
682 #endif // !OS_CHROMEOS 685 #endif // !OS_CHROMEOS
OLDNEW
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker_controller.cc ('k') | chrome/browser/ui/views/browser_actions_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698