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

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

Issue 5589001: Change drag and drop prefs on the right browser window. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: improve test comments. Created 10 years 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
« no previous file with comments | « no previous file | chrome/browser/ui/browser.h » ('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/compiler_specific.h" 8 #include "base/compiler_specific.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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); 362 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS));
363 363
364 GURL downloads_url(chrome::kChromeUIDownloadsURL); 364 GURL downloads_url(chrome::kChromeUIDownloadsURL);
365 ui_test_utils::NavigateToURL(browser(), downloads_url); 365 ui_test_utils::NavigateToURL(browser(), downloads_url);
366 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); 366 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS));
367 367
368 GURL blank_url(chrome::kAboutBlankURL); 368 GURL blank_url(chrome::kAboutBlankURL);
369 ui_test_utils::NavigateToURL(browser(), blank_url); 369 ui_test_utils::NavigateToURL(browser(), blank_url);
370 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); 370 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS));
371 } 371 }
372
373 // Change a tab into an application window.
374 IN_PROC_BROWSER_TEST_F(BrowserTest, ConvertTabToAppShortcut) {
375 ASSERT_TRUE(test_server()->Start());
376 GURL http_url(test_server()->GetURL(""));
377 ASSERT_TRUE(http_url.SchemeIs(chrome::kHttpScheme));
378
379 ASSERT_EQ(1, browser()->tab_count());
380 TabContents* initial_tab = browser()->GetTabContentsAt(0);
381 TabContents* app_tab = browser()->AddSelectedTabWithURL(
382 http_url, PageTransition::TYPED)->tab_contents();
383 ASSERT_EQ(2, browser()->tab_count());
384 ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile()));
385
386 // Normal tabs should accept load drops.
387 EXPECT_TRUE(initial_tab->GetMutableRendererPrefs()->can_accept_load_drops);
388 EXPECT_TRUE(app_tab->GetMutableRendererPrefs()->can_accept_load_drops);
389
390 // Turn |app_tab| into a tab in an app panel.
391 browser()->ConvertContentsToApplication(app_tab);
392
393 // The launch should have created a new browser.
394 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile()));
395
396 // Find the new browser.
397 Browser* app_browser = NULL;
398 for (BrowserList::const_iterator i = BrowserList::begin();
399 i != BrowserList::end() && !app_browser; ++i) {
400 if (*i != browser())
401 app_browser = *i;
402 }
403 ASSERT_TRUE(app_browser);
404
405 // Check that the tab contents is in the new browser, and not in the old.
406 ASSERT_EQ(1, browser()->tab_count());
407 ASSERT_EQ(initial_tab, browser()->GetTabContentsAt(0));
408
409 // Check that the appliaction browser has a single tab, and that tab contains
410 // the content that we app-ified.
411 ASSERT_EQ(1, app_browser->tab_count());
412 ASSERT_EQ(app_tab, app_browser->GetTabContentsAt(0));
413
414 // Normal tabs should accept load drops.
415 EXPECT_TRUE(initial_tab->GetMutableRendererPrefs()->can_accept_load_drops);
416
417 // The tab in an aopp window should not.
418 EXPECT_FALSE(app_tab->GetMutableRendererPrefs()->can_accept_load_drops);
419 }
420
372 #endif // !defined(OS_MACOSX) 421 #endif // !defined(OS_MACOSX)
373 422
374 // Test RenderView correctly send back favicon url for web page that redirects 423 // Test RenderView correctly send back favicon url for web page that redirects
375 // to an anchor in javascript body.onload handler. 424 // to an anchor in javascript body.onload handler.
376 IN_PROC_BROWSER_TEST_F(BrowserTest, FaviconOfOnloadRedirectToAnchorPage) { 425 IN_PROC_BROWSER_TEST_F(BrowserTest, FaviconOfOnloadRedirectToAnchorPage) {
377 ASSERT_TRUE(test_server()->Start()); 426 ASSERT_TRUE(test_server()->Start());
378 GURL url(test_server()->GetURL("files/onload_redirect_to_anchor.html")); 427 GURL url(test_server()->GetURL("files/onload_redirect_to_anchor.html"));
379 GURL expected_favicon_url(test_server()->GetURL("files/test.png")); 428 GURL expected_favicon_url(test_server()->GetURL("files/test.png"));
380 429
381 ui_test_utils::NavigateToURL(browser(), url); 430 ui_test_utils::NavigateToURL(browser(), url);
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 728
680 // The normal browser should now have four. 729 // The normal browser should now have four.
681 EXPECT_EQ(4, browser()->tab_count()); 730 EXPECT_EQ(4, browser()->tab_count());
682 731
683 // Close the additional browsers. 732 // Close the additional browsers.
684 popup_browser->CloseAllTabs(); 733 popup_browser->CloseAllTabs();
685 app_browser->CloseAllTabs(); 734 app_browser->CloseAllTabs();
686 app_popup_browser->CloseAllTabs(); 735 app_popup_browser->CloseAllTabs();
687 } 736 }
688 #endif 737 #endif
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698