| 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" | |
| 18 #include "chrome/browser/infobars/infobar_service.h" | 17 #include "chrome/browser/infobars/infobar_service.h" |
| 19 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h" | 18 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h" |
| 20 #include "chrome/browser/managed_mode/managed_user_service.h" | 19 #include "chrome/browser/managed_mode/managed_user_service.h" |
| 21 #include "chrome/browser/managed_mode/managed_user_service_factory.h" | 20 #include "chrome/browser/managed_mode/managed_user_service_factory.h" |
| 22 #include "chrome/browser/prefs/session_startup_pref.h" | 21 #include "chrome/browser/prefs/session_startup_pref.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/profiles/profile_impl.h" | 23 #include "chrome/browser/profiles/profile_impl.h" |
| 25 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
| 26 #include "chrome/browser/sessions/session_restore.h" | 25 #include "chrome/browser/sessions/session_restore.h" |
| 27 #include "chrome/browser/signin/signin_promo.h" | 26 #include "chrome/browser/signin/signin_promo.h" |
| (...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home, | 933 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home, |
| 935 browser()->host_desktop_type())); | 934 browser()->host_desktop_type())); |
| 936 new_browser = FindOneOtherBrowserForProfile(profile_home, NULL); | 935 new_browser = FindOneOtherBrowserForProfile(profile_home, NULL); |
| 937 ASSERT_TRUE(new_browser); | 936 ASSERT_TRUE(new_browser); |
| 938 TabStripModel* tab_strip = new_browser->tab_strip_model(); | 937 TabStripModel* tab_strip = new_browser->tab_strip_model(); |
| 939 ASSERT_EQ(1, tab_strip->count()); | 938 ASSERT_EQ(1, tab_strip->count()); |
| 940 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0); | 939 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0); |
| 941 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); | 940 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); |
| 942 InfoBarService* infobar_service = | 941 InfoBarService* infobar_service = |
| 943 InfoBarService::FromWebContents(web_contents); | 942 InfoBarService::FromWebContents(web_contents); |
| 944 EXPECT_EQ(1U, infobar_service->infobar_manager()->infobar_count()); | 943 EXPECT_EQ(1U, infobar_service->infobar_count()); |
| 945 | 944 |
| 946 // The profile which normally opens last open pages displays the new tab page. | 945 // The profile which normally opens last open pages displays the new tab page. |
| 947 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, | 946 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, |
| 948 browser()->host_desktop_type())); | 947 browser()->host_desktop_type())); |
| 949 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); | 948 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); |
| 950 ASSERT_TRUE(new_browser); | 949 ASSERT_TRUE(new_browser); |
| 951 tab_strip = new_browser->tab_strip_model(); | 950 tab_strip = new_browser->tab_strip_model(); |
| 952 ASSERT_EQ(1, tab_strip->count()); | 951 ASSERT_EQ(1, tab_strip->count()); |
| 953 web_contents = tab_strip->GetWebContentsAt(0); | 952 web_contents = tab_strip->GetWebContentsAt(0); |
| 954 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); | 953 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); |
| 955 infobar_service = InfoBarService::FromWebContents(web_contents); | 954 infobar_service = InfoBarService::FromWebContents(web_contents); |
| 956 EXPECT_EQ(1U, infobar_service->infobar_manager()->infobar_count()); | 955 EXPECT_EQ(1U, infobar_service->infobar_count()); |
| 957 | 956 |
| 958 // The profile which normally opens URLs displays the new tab page. | 957 // The profile which normally opens URLs displays the new tab page. |
| 959 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, | 958 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, |
| 960 browser()->host_desktop_type())); | 959 browser()->host_desktop_type())); |
| 961 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); | 960 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); |
| 962 ASSERT_TRUE(new_browser); | 961 ASSERT_TRUE(new_browser); |
| 963 tab_strip = new_browser->tab_strip_model(); | 962 tab_strip = new_browser->tab_strip_model(); |
| 964 ASSERT_EQ(1, tab_strip->count()); | 963 ASSERT_EQ(1, tab_strip->count()); |
| 965 web_contents = tab_strip->GetWebContentsAt(0); | 964 web_contents = tab_strip->GetWebContentsAt(0); |
| 966 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); | 965 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); |
| 967 infobar_service = InfoBarService::FromWebContents(web_contents); | 966 infobar_service = InfoBarService::FromWebContents(web_contents); |
| 968 EXPECT_EQ(1U, infobar_service->infobar_manager()->infobar_count()); | 967 EXPECT_EQ(1U, infobar_service->infobar_count()); |
| 969 } | 968 } |
| 970 | 969 |
| 971 class ManagedModeBrowserCreatorTest : public InProcessBrowserTest { | 970 class ManagedModeBrowserCreatorTest : public InProcessBrowserTest { |
| 972 protected: | 971 protected: |
| 973 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 972 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 974 InProcessBrowserTest::SetUpCommandLine(command_line); | 973 InProcessBrowserTest::SetUpCommandLine(command_line); |
| 975 command_line->AppendSwitchASCII(switches::kManagedUserId, "asdf"); | 974 command_line->AppendSwitchASCII(switches::kManagedUserId, "asdf"); |
| 976 } | 975 } |
| 977 }; | 976 }; |
| 978 | 977 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1403 ASSERT_EQ(1, tab_strip->count()); | 1402 ASSERT_EQ(1, tab_strip->count()); |
| 1404 EXPECT_EQ("title1.html", | 1403 EXPECT_EQ("title1.html", |
| 1405 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); | 1404 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); |
| 1406 } | 1405 } |
| 1407 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 1406 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
| 1408 | 1407 |
| 1409 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || | 1408 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || |
| 1410 // defined(ENABLE_CONFIGURATION_POLICY) | 1409 // defined(ENABLE_CONFIGURATION_POLICY) |
| 1411 | 1410 |
| 1412 #endif // !defined(OS_CHROMEOS) | 1411 #endif // !defined(OS_CHROMEOS) |
| OLD | NEW |