OLD | NEW |
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 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 EXPECT_EQ(1U, |
942 InfoBarService::FromWebContents(web_contents)->infobar_count()); | 943 InfoBarService::FromWebContents(web_contents) |
| 944 ->infobar_manager() |
| 945 .infobar_count()); |
943 | 946 |
944 // The profile which normally opens last open pages displays the new tab page. | 947 // The profile which normally opens last open pages displays the new tab page. |
945 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, | 948 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, |
946 browser()->host_desktop_type())); | 949 browser()->host_desktop_type())); |
947 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); | 950 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); |
948 ASSERT_TRUE(new_browser); | 951 ASSERT_TRUE(new_browser); |
949 tab_strip = new_browser->tab_strip_model(); | 952 tab_strip = new_browser->tab_strip_model(); |
950 ASSERT_EQ(1, tab_strip->count()); | 953 ASSERT_EQ(1, tab_strip->count()); |
951 web_contents = tab_strip->GetWebContentsAt(0); | 954 web_contents = tab_strip->GetWebContentsAt(0); |
952 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); | 955 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); |
953 EXPECT_EQ(1U, | 956 EXPECT_EQ(1U, |
954 InfoBarService::FromWebContents(web_contents)->infobar_count()); | 957 InfoBarService::FromWebContents(web_contents) |
| 958 ->infobar_manager() |
| 959 .infobar_count()); |
955 | 960 |
956 // The profile which normally opens URLs displays the new tab page. | 961 // The profile which normally opens URLs displays the new tab page. |
957 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, | 962 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, |
958 browser()->host_desktop_type())); | 963 browser()->host_desktop_type())); |
959 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); | 964 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); |
960 ASSERT_TRUE(new_browser); | 965 ASSERT_TRUE(new_browser); |
961 tab_strip = new_browser->tab_strip_model(); | 966 tab_strip = new_browser->tab_strip_model(); |
962 ASSERT_EQ(1, tab_strip->count()); | 967 ASSERT_EQ(1, tab_strip->count()); |
963 web_contents = tab_strip->GetWebContentsAt(0); | 968 web_contents = tab_strip->GetWebContentsAt(0); |
964 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); | 969 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); |
965 EXPECT_EQ(1U, | 970 EXPECT_EQ(1U, |
966 InfoBarService::FromWebContents(web_contents)->infobar_count()); | 971 InfoBarService::FromWebContents(web_contents) |
| 972 ->infobar_manager() |
| 973 .infobar_count()); |
967 } | 974 } |
968 | 975 |
969 class ManagedModeBrowserCreatorTest : public InProcessBrowserTest { | 976 class ManagedModeBrowserCreatorTest : public InProcessBrowserTest { |
970 protected: | 977 protected: |
971 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 978 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
972 InProcessBrowserTest::SetUpCommandLine(command_line); | 979 InProcessBrowserTest::SetUpCommandLine(command_line); |
973 command_line->AppendSwitchASCII(switches::kManagedUserId, "asdf"); | 980 command_line->AppendSwitchASCII(switches::kManagedUserId, "asdf"); |
974 } | 981 } |
975 }; | 982 }; |
976 | 983 |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 ASSERT_EQ(1, tab_strip->count()); | 1408 ASSERT_EQ(1, tab_strip->count()); |
1402 EXPECT_EQ("title1.html", | 1409 EXPECT_EQ("title1.html", |
1403 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); | 1410 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); |
1404 } | 1411 } |
1405 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 1412 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
1406 | 1413 |
1407 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || | 1414 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || |
1408 // defined(ENABLE_CONFIGURATION_POLICY) | 1415 // defined(ENABLE_CONFIGURATION_POLICY) |
1409 | 1416 |
1410 #endif // !defined(OS_CHROMEOS) | 1417 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |