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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.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" |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 Browser* new_browser = NULL; | 865 Browser* new_browser = NULL; |
866 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home, | 866 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home, |
867 browser()->host_desktop_type())); | 867 browser()->host_desktop_type())); |
868 new_browser = FindOneOtherBrowserForProfile(profile_home, NULL); | 868 new_browser = FindOneOtherBrowserForProfile(profile_home, NULL); |
869 ASSERT_TRUE(new_browser); | 869 ASSERT_TRUE(new_browser); |
870 TabStripModel* tab_strip = new_browser->tab_strip_model(); | 870 TabStripModel* tab_strip = new_browser->tab_strip_model(); |
871 ASSERT_EQ(1, tab_strip->count()); | 871 ASSERT_EQ(1, tab_strip->count()); |
872 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0); | 872 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0); |
873 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); | 873 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); |
874 EXPECT_EQ(1U, | 874 EXPECT_EQ(1U, |
875 InfoBarService::FromWebContents(web_contents)->GetInfoBarCount()); | 875 InfoBarService::FromWebContents(web_contents)->infobar_count()); |
876 | 876 |
877 // The profile which normally opens last open pages displays the new tab page. | 877 // The profile which normally opens last open pages displays the new tab page. |
878 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, | 878 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, |
879 browser()->host_desktop_type())); | 879 browser()->host_desktop_type())); |
880 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); | 880 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); |
881 ASSERT_TRUE(new_browser); | 881 ASSERT_TRUE(new_browser); |
882 tab_strip = new_browser->tab_strip_model(); | 882 tab_strip = new_browser->tab_strip_model(); |
883 ASSERT_EQ(1, tab_strip->count()); | 883 ASSERT_EQ(1, tab_strip->count()); |
884 web_contents = tab_strip->GetWebContentsAt(0); | 884 web_contents = tab_strip->GetWebContentsAt(0); |
885 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); | 885 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); |
886 EXPECT_EQ(1U, | 886 EXPECT_EQ(1U, |
887 InfoBarService::FromWebContents(web_contents)->GetInfoBarCount()); | 887 InfoBarService::FromWebContents(web_contents)->infobar_count()); |
888 | 888 |
889 // The profile which normally opens URLs displays the new tab page. | 889 // The profile which normally opens URLs displays the new tab page. |
890 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, | 890 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, |
891 browser()->host_desktop_type())); | 891 browser()->host_desktop_type())); |
892 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); | 892 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); |
893 ASSERT_TRUE(new_browser); | 893 ASSERT_TRUE(new_browser); |
894 tab_strip = new_browser->tab_strip_model(); | 894 tab_strip = new_browser->tab_strip_model(); |
895 ASSERT_EQ(1, tab_strip->count()); | 895 ASSERT_EQ(1, tab_strip->count()); |
896 web_contents = tab_strip->GetWebContentsAt(0); | 896 web_contents = tab_strip->GetWebContentsAt(0); |
897 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); | 897 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); |
898 EXPECT_EQ(1U, | 898 EXPECT_EQ(1U, |
899 InfoBarService::FromWebContents(web_contents)->GetInfoBarCount()); | 899 InfoBarService::FromWebContents(web_contents)->infobar_count()); |
900 } | 900 } |
901 | 901 |
902 class ManagedModeBrowserCreatorTest : public InProcessBrowserTest { | 902 class ManagedModeBrowserCreatorTest : public InProcessBrowserTest { |
903 protected: | 903 protected: |
904 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 904 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
905 InProcessBrowserTest::SetUpCommandLine(command_line); | 905 InProcessBrowserTest::SetUpCommandLine(command_line); |
906 command_line->AppendSwitch(switches::kEnableManagedUsers); | 906 command_line->AppendSwitch(switches::kEnableManagedUsers); |
907 } | 907 } |
908 }; | 908 }; |
909 | 909 |
(...skipping 30 matching lines...) Expand all Loading... |
940 | 940 |
941 // Managed user should be in elevated state. | 941 // Managed user should be in elevated state. |
942 bool is_elevated = ManagedModeNavigationObserver::FromWebContents( | 942 bool is_elevated = ManagedModeNavigationObserver::FromWebContents( |
943 web_contents)->is_elevated(); | 943 web_contents)->is_elevated(); |
944 EXPECT_TRUE(is_elevated); | 944 EXPECT_TRUE(is_elevated); |
945 } | 945 } |
946 | 946 |
947 #endif // ENABLE_MANAGED_USERS | 947 #endif // ENABLE_MANAGED_USERS |
948 | 948 |
949 #endif // !OS_CHROMEOS | 949 #endif // !OS_CHROMEOS |
OLD | NEW |