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

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs_test.cc

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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
OLDNEW
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 5
6 #include <string> 6 #include <string>
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 incognito_browser), 391 incognito_browser),
392 keys::kIncognitoModeIsDisabled)); 392 keys::kIncognitoModeIsDisabled));
393 } 393 }
394 394
395 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, QueryCurrentWindowTabs) { 395 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, QueryCurrentWindowTabs) {
396 const size_t kExtraWindows = 3; 396 const size_t kExtraWindows = 3;
397 for (size_t i = 0; i < kExtraWindows; ++i) 397 for (size_t i = 0; i < kExtraWindows; ++i)
398 CreateBrowser(browser()->profile()); 398 CreateBrowser(browser()->profile());
399 399
400 GURL url(url::kAboutBlankURL); 400 GURL url(url::kAboutBlankURL);
401 AddTabAtIndexToBrowser(browser(), 0, url, content::PAGE_TRANSITION_LINK); 401 AddTabAtIndexToBrowser(browser(), 0, url, ui::PAGE_TRANSITION_LINK);
402 int window_id = ExtensionTabUtil::GetWindowId(browser()); 402 int window_id = ExtensionTabUtil::GetWindowId(browser());
403 403
404 // Get tabs in the 'current' window called from non-focused browser. 404 // Get tabs in the 'current' window called from non-focused browser.
405 scoped_refptr<TabsQueryFunction> function = new TabsQueryFunction(); 405 scoped_refptr<TabsQueryFunction> function = new TabsQueryFunction();
406 function->set_extension(test_util::CreateEmptyExtension().get()); 406 function->set_extension(test_util::CreateEmptyExtension().get());
407 scoped_ptr<base::ListValue> result(utils::ToList( 407 scoped_ptr<base::ListValue> result(utils::ToList(
408 utils::RunFunctionAndReturnSingleResult(function.get(), 408 utils::RunFunctionAndReturnSingleResult(function.get(),
409 "[{\"currentWindow\":true}]", 409 "[{\"currentWindow\":true}]",
410 browser()))); 410 browser())));
411 411
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 function.get(), 510 function.get(),
511 base::StringPrintf(kArgsMaximizedWithBounds, window_id), 511 base::StringPrintf(kArgsMaximizedWithBounds, window_id),
512 browser()), 512 browser()),
513 keys::kInvalidWindowStateError)); 513 keys::kInvalidWindowStateError));
514 } 514 }
515 515
516 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DuplicateTab) { 516 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DuplicateTab) {
517 content::OpenURLParams params(GURL(url::kAboutBlankURL), 517 content::OpenURLParams params(GURL(url::kAboutBlankURL),
518 content::Referrer(), 518 content::Referrer(),
519 NEW_FOREGROUND_TAB, 519 NEW_FOREGROUND_TAB,
520 content::PAGE_TRANSITION_LINK, 520 ui::PAGE_TRANSITION_LINK,
521 false); 521 false);
522 content::WebContents* web_contents = browser()->OpenURL(params); 522 content::WebContents* web_contents = browser()->OpenURL(params);
523 int tab_id = ExtensionTabUtil::GetTabId(web_contents); 523 int tab_id = ExtensionTabUtil::GetTabId(web_contents);
524 int window_id = ExtensionTabUtil::GetWindowIdOfTab(web_contents); 524 int window_id = ExtensionTabUtil::GetWindowIdOfTab(web_contents);
525 int tab_index = -1; 525 int tab_index = -1;
526 TabStripModel* tab_strip; 526 TabStripModel* tab_strip;
527 ExtensionTabUtil::GetTabStripModel(web_contents, &tab_strip, &tab_index); 527 ExtensionTabUtil::GetTabStripModel(web_contents, &tab_strip, &tab_index);
528 528
529 scoped_refptr<TabsDuplicateFunction> duplicate_tab_function( 529 scoped_refptr<TabsDuplicateFunction> duplicate_tab_function(
530 new TabsDuplicateFunction()); 530 new TabsDuplicateFunction());
(...skipping 23 matching lines...) Expand all
554 // The test empty tab extension has tabs permissions, therefore 554 // The test empty tab extension has tabs permissions, therefore
555 // |duplicate_result| should contain url, title, and faviconUrl 555 // |duplicate_result| should contain url, title, and faviconUrl
556 // in the function result. 556 // in the function result.
557 EXPECT_TRUE(utils::HasPrivacySensitiveFields(duplicate_result.get())); 557 EXPECT_TRUE(utils::HasPrivacySensitiveFields(duplicate_result.get()));
558 } 558 }
559 559
560 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DuplicateTabNoPermission) { 560 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DuplicateTabNoPermission) {
561 content::OpenURLParams params(GURL(url::kAboutBlankURL), 561 content::OpenURLParams params(GURL(url::kAboutBlankURL),
562 content::Referrer(), 562 content::Referrer(),
563 NEW_FOREGROUND_TAB, 563 NEW_FOREGROUND_TAB,
564 content::PAGE_TRANSITION_LINK, 564 ui::PAGE_TRANSITION_LINK,
565 false); 565 false);
566 content::WebContents* web_contents = browser()->OpenURL(params); 566 content::WebContents* web_contents = browser()->OpenURL(params);
567 int tab_id = ExtensionTabUtil::GetTabId(web_contents); 567 int tab_id = ExtensionTabUtil::GetTabId(web_contents);
568 int window_id = ExtensionTabUtil::GetWindowIdOfTab(web_contents); 568 int window_id = ExtensionTabUtil::GetWindowIdOfTab(web_contents);
569 int tab_index = -1; 569 int tab_index = -1;
570 TabStripModel* tab_strip; 570 TabStripModel* tab_strip;
571 ExtensionTabUtil::GetTabStripModel(web_contents, &tab_strip, &tab_index); 571 ExtensionTabUtil::GetTabStripModel(web_contents, &tab_strip, &tab_index);
572 572
573 scoped_refptr<TabsDuplicateFunction> duplicate_tab_function( 573 scoped_refptr<TabsDuplicateFunction> duplicate_tab_function(
574 new TabsDuplicateFunction()); 574 new TabsDuplicateFunction());
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 namespace { 760 namespace {
761 761
762 double GetZoomLevel(const content::WebContents* web_contents) { 762 double GetZoomLevel(const content::WebContents* web_contents) {
763 return ZoomController::FromWebContents(web_contents)->GetZoomLevel(); 763 return ZoomController::FromWebContents(web_contents)->GetZoomLevel();
764 } 764 }
765 765
766 content::OpenURLParams GetOpenParams(const char* url) { 766 content::OpenURLParams GetOpenParams(const char* url) {
767 return content::OpenURLParams(GURL(url), 767 return content::OpenURLParams(GURL(url),
768 content::Referrer(), 768 content::Referrer(),
769 NEW_FOREGROUND_TAB, 769 NEW_FOREGROUND_TAB,
770 content::PAGE_TRANSITION_LINK, 770 ui::PAGE_TRANSITION_LINK,
771 false); 771 false);
772 } 772 }
773 773
774 } // namespace 774 } // namespace
775 775
776 IN_PROC_BROWSER_TEST_F(ExtensionTabsZoomTest, SetAndGetZoom) { 776 IN_PROC_BROWSER_TEST_F(ExtensionTabsZoomTest, SetAndGetZoom) {
777 content::OpenURLParams params(GetOpenParams(url::kAboutBlankURL)); 777 content::OpenURLParams params(GetOpenParams(url::kAboutBlankURL));
778 content::WebContents* web_contents = OpenUrlAndWaitForLoad(params.url); 778 content::WebContents* web_contents = OpenUrlAndWaitForLoad(params.url);
779 int tab_id = ExtensionTabUtil::GetTabId(web_contents); 779 int tab_id = ExtensionTabUtil::GetTabId(web_contents);
780 780
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 // Test chrome.tabs.setZoom(). 905 // Test chrome.tabs.setZoom().
906 error = RunSetZoomExpectError(tab_id, 3.14159); 906 error = RunSetZoomExpectError(tab_id, 3.14159);
907 EXPECT_TRUE(MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); 907 EXPECT_TRUE(MatchPattern(error, manifest_errors::kCannotAccessChromeUrl));
908 908
909 // chrome.tabs.setZoomSettings(). 909 // chrome.tabs.setZoomSettings().
910 error = RunSetZoomSettingsExpectError(tab_id, "manual", "per-tab"); 910 error = RunSetZoomSettingsExpectError(tab_id, "manual", "per-tab");
911 EXPECT_TRUE(MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); 911 EXPECT_TRUE(MatchPattern(error, manifest_errors::kCannotAccessChromeUrl));
912 } 912 }
913 913
914 } // namespace extensions 914 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698