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

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

Issue 211273007: Split InfoBarService core code into InfoBarManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + comments Created 6 years, 8 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 #include <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/extensions/extension_browsertest.h" 13 #include "chrome/browser/extensions/extension_browsertest.h"
14 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/extensions/launch_util.h" 15 #include "chrome/browser/extensions/launch_util.h"
16 #include "chrome/browser/first_run/first_run.h" 16 #include "chrome/browser/first_run/first_run.h"
17 #include "chrome/browser/infobars/infobar_manager.h"
17 #include "chrome/browser/infobars/infobar_service.h" 18 #include "chrome/browser/infobars/infobar_service.h"
18 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h" 19 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h"
19 #include "chrome/browser/managed_mode/managed_user_service.h" 20 #include "chrome/browser/managed_mode/managed_user_service.h"
20 #include "chrome/browser/managed_mode/managed_user_service_factory.h" 21 #include "chrome/browser/managed_mode/managed_user_service_factory.h"
21 #include "chrome/browser/prefs/session_startup_pref.h" 22 #include "chrome/browser/prefs/session_startup_pref.h"
22 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/profiles/profile_impl.h" 24 #include "chrome/browser/profiles/profile_impl.h"
24 #include "chrome/browser/profiles/profile_manager.h" 25 #include "chrome/browser/profiles/profile_manager.h"
25 #include "chrome/browser/sessions/session_restore.h" 26 #include "chrome/browser/sessions/session_restore.h"
26 #include "chrome/browser/signin/signin_promo.h" 27 #include "chrome/browser/signin/signin_promo.h"
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 // The profile which normally opens the home page displays the new tab page. 932 // The profile which normally opens the home page displays the new tab page.
932 Browser* new_browser = NULL; 933 Browser* new_browser = NULL;
933 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home, 934 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home,
934 browser()->host_desktop_type())); 935 browser()->host_desktop_type()));
935 new_browser = FindOneOtherBrowserForProfile(profile_home, NULL); 936 new_browser = FindOneOtherBrowserForProfile(profile_home, NULL);
936 ASSERT_TRUE(new_browser); 937 ASSERT_TRUE(new_browser);
937 TabStripModel* tab_strip = new_browser->tab_strip_model(); 938 TabStripModel* tab_strip = new_browser->tab_strip_model();
938 ASSERT_EQ(1, tab_strip->count()); 939 ASSERT_EQ(1, tab_strip->count());
939 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0); 940 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0);
940 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); 941 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL());
941 EXPECT_EQ(1U, 942 InfoBarService* infobar_service =
942 InfoBarService::FromWebContents(web_contents)->infobar_count()); 943 InfoBarService::FromWebContents(web_contents);
944 EXPECT_EQ(1U, infobar_service->infobar_manager()->infobar_count());
943 945
944 // The profile which normally opens last open pages displays the new tab page. 946 // The profile which normally opens last open pages displays the new tab page.
945 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, 947 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last,
946 browser()->host_desktop_type())); 948 browser()->host_desktop_type()));
947 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); 949 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL);
948 ASSERT_TRUE(new_browser); 950 ASSERT_TRUE(new_browser);
949 tab_strip = new_browser->tab_strip_model(); 951 tab_strip = new_browser->tab_strip_model();
950 ASSERT_EQ(1, tab_strip->count()); 952 ASSERT_EQ(1, tab_strip->count());
951 web_contents = tab_strip->GetWebContentsAt(0); 953 web_contents = tab_strip->GetWebContentsAt(0);
952 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); 954 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL());
953 EXPECT_EQ(1U, 955 infobar_service = InfoBarService::FromWebContents(web_contents);
954 InfoBarService::FromWebContents(web_contents)->infobar_count()); 956 EXPECT_EQ(1U, infobar_service->infobar_manager()->infobar_count());
955 957
956 // The profile which normally opens URLs displays the new tab page. 958 // The profile which normally opens URLs displays the new tab page.
957 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, 959 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls,
958 browser()->host_desktop_type())); 960 browser()->host_desktop_type()));
959 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); 961 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL);
960 ASSERT_TRUE(new_browser); 962 ASSERT_TRUE(new_browser);
961 tab_strip = new_browser->tab_strip_model(); 963 tab_strip = new_browser->tab_strip_model();
962 ASSERT_EQ(1, tab_strip->count()); 964 ASSERT_EQ(1, tab_strip->count());
963 web_contents = tab_strip->GetWebContentsAt(0); 965 web_contents = tab_strip->GetWebContentsAt(0);
964 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); 966 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL());
965 EXPECT_EQ(1U, 967 infobar_service = InfoBarService::FromWebContents(web_contents);
966 InfoBarService::FromWebContents(web_contents)->infobar_count()); 968 EXPECT_EQ(1U, infobar_service->infobar_manager()->infobar_count());
967 } 969 }
968 970
969 class ManagedModeBrowserCreatorTest : public InProcessBrowserTest { 971 class ManagedModeBrowserCreatorTest : public InProcessBrowserTest {
970 protected: 972 protected:
971 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 973 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
972 InProcessBrowserTest::SetUpCommandLine(command_line); 974 InProcessBrowserTest::SetUpCommandLine(command_line);
973 command_line->AppendSwitchASCII(switches::kManagedUserId, "asdf"); 975 command_line->AppendSwitchASCII(switches::kManagedUserId, "asdf");
974 } 976 }
975 }; 977 };
976 978
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 ASSERT_EQ(1, tab_strip->count()); 1403 ASSERT_EQ(1, tab_strip->count());
1402 EXPECT_EQ("title1.html", 1404 EXPECT_EQ("title1.html",
1403 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); 1405 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
1404 } 1406 }
1405 #endif // defined(ENABLE_CONFIGURATION_POLICY) 1407 #endif // defined(ENABLE_CONFIGURATION_POLICY)
1406 1408
1407 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || 1409 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) ||
1408 // defined(ENABLE_CONFIGURATION_POLICY) 1410 // defined(ENABLE_CONFIGURATION_POLICY)
1409 1411
1410 #endif // !defined(OS_CHROMEOS) 1412 #endif // !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/session_crashed_infobar_delegate_unittest.cc ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698