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

Side by Side Diff: chrome/browser/browser_browsertest.cc

Issue 2747011: Further refine the pinned tab navigation algorithm. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: comments Created 10 years, 6 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
« no previous file with comments | « chrome/browser/browser.cc ('k') | chrome/browser/browser_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <string> 5 #include <string>
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 // Open the app. Focus should move to the panel. 878 // Open the app. Focus should move to the panel.
879 Browser::OpenApplication(profile_, extension_app_->id()); 879 Browser::OpenApplication(profile_, extension_app_->id());
880 ASSERT_EQ(extra_browser, BrowserList::GetLastActive()); 880 ASSERT_EQ(extra_browser, BrowserList::GetLastActive());
881 ASSERT_EQ(2, extra_browser->tab_count()); 881 ASSERT_EQ(2, extra_browser->tab_count());
882 882
883 browser()->window()->Show(); 883 browser()->window()->Show();
884 Browser::OpenApplication(profile_, extension_app_->id()); 884 Browser::OpenApplication(profile_, extension_app_->id());
885 ASSERT_EQ(browser(), BrowserList::GetLastActive()); 885 ASSERT_EQ(browser(), BrowserList::GetLastActive());
886 ASSERT_EQ(2, browser()->tab_count()); 886 ASSERT_EQ(2, browser()->tab_count());
887 } 887 }
888
889 // TODO(ben): this test was never enabled. It has bit-rotted since being added.
890 // It originally lived in browser_unittest.cc, but has been moved here to make
891 // room for real browser unit tests.
892 #if 0
893 class BrowserTest2 : public InProcessBrowserTest {
894 public:
895 BrowserTest2() {
896 host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL);
897 // Avoid making external DNS lookups. In this test we don't need this
898 // to succeed.
899 host_resolver_proc_->AddSimulatedFailure("*.google.com");
900 scoped_host_resolver_proc_.Init(host_resolver_proc_.get());
901 }
902
903 private:
904 scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_proc_;
905 net::ScopedDefaultHostResolverProc scoped_host_resolver_proc_;
906 };
907
908 IN_PROC_BROWSER_TEST_F(BrowserTest2, NoTabsInPopups) {
909 Browser::RegisterAppPrefs(L"Test");
910
911 // We start with a normal browser with one tab.
912 EXPECT_EQ(1, browser()->tab_count());
913
914 // Open a popup browser with a single blank foreground tab.
915 Browser* popup_browser = browser()->CreateForPopup(browser()->profile());
916 popup_browser->AddBlankTab(true);
917 EXPECT_EQ(1, popup_browser->tab_count());
918
919 // Now try opening another tab in the popup browser.
920 popup_browser->AddTabWithURL(
921 GURL(chrome::kAboutBlankURL), GURL(), PageTransition::TYPED, -1,
922 Browser::ADD_SELECTED, NULL, std::string());
923
924 // The popup should still only have one tab.
925 EXPECT_EQ(1, popup_browser->tab_count());
926
927 // The normal browser should now have two.
928 EXPECT_EQ(2, browser()->tab_count());
929
930 // Open an app frame browser with a single blank foreground tab.
931 Browser* app_browser =
932 browser()->CreateForApp(L"Test", browser()->profile(), false);
933 app_browser->AddBlankTab(true);
934 EXPECT_EQ(1, app_browser->tab_count());
935
936 // Now try opening another tab in the app browser.
937 app_browser->AddTabWithURL(
938 GURL(chrome::kAboutBlankURL), GURL(), PageTransition::TYPED, -1,
939 Browser::ADD_SELECTED, NULL, std::string());
940
941 // The popup should still only have one tab.
942 EXPECT_EQ(1, app_browser->tab_count());
943
944 // The normal browser should now have three.
945 EXPECT_EQ(3, browser()->tab_count());
946
947 // Open an app frame popup browser with a single blank foreground tab.
948 Browser* app_popup_browser =
949 browser()->CreateForApp(L"Test", browser()->profile(), false);
950 app_popup_browser->AddBlankTab(true);
951 EXPECT_EQ(1, app_popup_browser->tab_count());
952
953 // Now try opening another tab in the app popup browser.
954 app_popup_browser->AddTabWithURL(
955 GURL(chrome::kAboutBlankURL), GURL(), PageTransition::TYPED, -1,
956 Browser::ADD_SELECTED, NULL, std::string());
957
958 // The popup should still only have one tab.
959 EXPECT_EQ(1, app_popup_browser->tab_count());
960
961 // The normal browser should now have four.
962 EXPECT_EQ(4, browser()->tab_count());
963
964 // Close the additional browsers.
965 popup_browser->CloseAllTabs();
966 app_browser->CloseAllTabs();
967 app_popup_browser->CloseAllTabs();
968 }
969 #endif
OLDNEW
« no previous file with comments | « chrome/browser/browser.cc ('k') | chrome/browser/browser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698