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

Side by Side Diff: chrome/browser/extensions/api/extension_action/browser_action_apitest.cc

Issue 11419276: Remove tabstrip wrappers in browser_tabstrip. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gtk Created 8 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
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 #include "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
11 #include "chrome/browser/extensions/browser_action_test_util.h" 11 #include "chrome/browser/extensions/browser_action_test_util.h"
12 #include "chrome/browser/extensions/extension_action.h" 12 #include "chrome/browser/extensions/extension_action.h"
13 #include "chrome/browser/extensions/extension_action_icon_factory.h" 13 #include "chrome/browser/extensions/extension_action_icon_factory.h"
14 #include "chrome/browser/extensions/extension_action_manager.h" 14 #include "chrome/browser/extensions/extension_action_manager.h"
15 #include "chrome/browser/extensions/extension_apitest.h" 15 #include "chrome/browser/extensions/extension_apitest.h"
16 #include "chrome/browser/extensions/extension_service.h" 16 #include "chrome/browser/extensions/extension_service.h"
17 #include "chrome/browser/extensions/extension_system.h" 17 #include "chrome/browser/extensions/extension_system.h"
18 #include "chrome/browser/extensions/extension_tab_util.h" 18 #include "chrome/browser/extensions/extension_tab_util.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_commands.h" 21 #include "chrome/browser/ui/browser_commands.h"
22 #include "chrome/browser/ui/browser_tabstrip.h"
23 #include "chrome/browser/ui/browser_window.h" 22 #include "chrome/browser/ui/browser_window.h"
23 #include "chrome/browser/ui/tabs/tab_strip_model.h"
24 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
25 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
26 #include "chrome/test/base/ui_test_utils.h" 26 #include "chrome/test/base/ui_test_utils.h"
27 #include "content/public/browser/notification_service.h" 27 #include "content/public/browser/notification_service.h"
28 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
29 #include "content/public/test/browser_test_utils.h" 29 #include "content/public/test/browser_test_utils.h"
30 #include "grit/theme_resources.h" 30 #include "grit/theme_resources.h"
31 #include "ui/base/resource/resource_bundle.h" 31 #include "ui/base/resource/resource_bundle.h"
32 #include "ui/gfx/rect.h" 32 #include "ui/gfx/rect.h"
33 #include "ui/gfx/size.h" 33 #include "ui/gfx/size.h"
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 ResultCatcher catcher; 324 ResultCatcher catcher;
325 GetBrowserActionsBar().Press(0); 325 GetBrowserActionsBar().Press(0);
326 ASSERT_TRUE(catcher.GetNextResult()); 326 ASSERT_TRUE(catcher.GetNextResult());
327 EXPECT_EQ("Showing icon 2", GetBrowserActionsBar().GetTooltip(0)); 327 EXPECT_EQ("Showing icon 2", GetBrowserActionsBar().GetTooltip(0));
328 328
329 // Open a new tab, the title should go back. 329 // Open a new tab, the title should go back.
330 chrome::NewTab(browser()); 330 chrome::NewTab(browser());
331 EXPECT_EQ("hi!", GetBrowserActionsBar().GetTooltip(0)); 331 EXPECT_EQ("hi!", GetBrowserActionsBar().GetTooltip(0));
332 332
333 // Go back to first tab, changed title should reappear. 333 // Go back to first tab, changed title should reappear.
334 chrome::ActivateTabAt(browser(), 0, true); 334 browser()->tab_strip_model()->ActivateTabAt(0, true);
335 EXPECT_EQ("Showing icon 2", GetBrowserActionsBar().GetTooltip(0)); 335 EXPECT_EQ("Showing icon 2", GetBrowserActionsBar().GetTooltip(0));
336 336
337 // Reload that tab, default title should come back. 337 // Reload that tab, default title should come back.
338 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); 338 ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
339 EXPECT_EQ("hi!", GetBrowserActionsBar().GetTooltip(0)); 339 EXPECT_EQ("hi!", GetBrowserActionsBar().GetTooltip(0));
340 } 340 }
341 341
342 // http://code.google.com/p/chromium/issues/detail?id=70829 342 // http://code.google.com/p/chromium/issues/detail?id=70829
343 // Mac used to be ok, but then mac 10.5 started failing too. =( 343 // Mac used to be ok, but then mac 10.5 started failing too. =(
344 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DISABLED_BrowserActionPopup) { 344 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DISABLED_BrowserActionPopup) {
(...skipping 30 matching lines...) Expand all
375 } 375 }
376 376
377 // Test that calling chrome.browserAction.setPopup() can enable and change 377 // Test that calling chrome.browserAction.setPopup() can enable and change
378 // a popup. 378 // a popup.
379 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionAddPopup) { 379 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionAddPopup) {
380 ASSERT_TRUE(RunExtensionTest("browser_action/add_popup")) << message_; 380 ASSERT_TRUE(RunExtensionTest("browser_action/add_popup")) << message_;
381 const Extension* extension = GetSingleLoadedExtension(); 381 const Extension* extension = GetSingleLoadedExtension();
382 ASSERT_TRUE(extension) << message_; 382 ASSERT_TRUE(extension) << message_;
383 383
384 int tab_id = ExtensionTabUtil::GetTabId( 384 int tab_id = ExtensionTabUtil::GetTabId(
385 chrome::GetActiveWebContents(browser())); 385 browser()->tab_strip_model()->GetActiveWebContents());
386 386
387 ExtensionAction* browser_action = GetBrowserAction(*extension); 387 ExtensionAction* browser_action = GetBrowserAction(*extension);
388 ASSERT_TRUE(browser_action) 388 ASSERT_TRUE(browser_action)
389 << "Browser action test extension should have a browser action."; 389 << "Browser action test extension should have a browser action.";
390 390
391 ASSERT_FALSE(browser_action->HasPopup(tab_id)); 391 ASSERT_FALSE(browser_action->HasPopup(tab_id));
392 ASSERT_FALSE(browser_action->HasPopup(ExtensionAction::kDefaultTabId)); 392 ASSERT_FALSE(browser_action->HasPopup(ExtensionAction::kDefaultTabId));
393 393
394 // Simulate a click on the browser action icon. The onClicked handler 394 // Simulate a click on the browser action icon. The onClicked handler
395 // will add a popup. 395 // will add a popup.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 } 431 }
432 432
433 // Test that calling chrome.browserAction.setPopup() can remove a popup. 433 // Test that calling chrome.browserAction.setPopup() can remove a popup.
434 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionRemovePopup) { 434 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionRemovePopup) {
435 // Load the extension, which has a browser action with a default popup. 435 // Load the extension, which has a browser action with a default popup.
436 ASSERT_TRUE(RunExtensionTest("browser_action/remove_popup")) << message_; 436 ASSERT_TRUE(RunExtensionTest("browser_action/remove_popup")) << message_;
437 const Extension* extension = GetSingleLoadedExtension(); 437 const Extension* extension = GetSingleLoadedExtension();
438 ASSERT_TRUE(extension) << message_; 438 ASSERT_TRUE(extension) << message_;
439 439
440 int tab_id = ExtensionTabUtil::GetTabId( 440 int tab_id = ExtensionTabUtil::GetTabId(
441 chrome::GetActiveWebContents(browser())); 441 browser()->tab_strip_model()->GetActiveWebContents());
442 442
443 ExtensionAction* browser_action = GetBrowserAction(*extension); 443 ExtensionAction* browser_action = GetBrowserAction(*extension);
444 ASSERT_TRUE(browser_action) 444 ASSERT_TRUE(browser_action)
445 << "Browser action test extension should have a browser action."; 445 << "Browser action test extension should have a browser action.";
446 446
447 ASSERT_TRUE(browser_action->HasPopup(tab_id)) 447 ASSERT_TRUE(browser_action->HasPopup(tab_id))
448 << "Expect a browser action popup before the test removes it."; 448 << "Expect a browser action popup before the test removes it.";
449 ASSERT_TRUE(browser_action->HasPopup(ExtensionAction::kDefaultTabId)) 449 ASSERT_TRUE(browser_action->HasPopup(ExtensionAction::kDefaultTabId))
450 << "Expect a browser action popup is the default for all tabs."; 450 << "Expect a browser action popup is the default for all tabs.";
451 451
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 ASSERT_TRUE(catcher.GetNextResult()); 649 ASSERT_TRUE(catcher.GetNextResult());
650 650
651 // Test the getters for a specific tab. 651 // Test the getters for a specific tab.
652 ui_test_utils::NavigateToURL(browser(), 652 ui_test_utils::NavigateToURL(browser(),
653 GURL(extension->GetResourceURL("update2.html"))); 653 GURL(extension->GetResourceURL("update2.html")));
654 ASSERT_TRUE(catcher.GetNextResult()); 654 ASSERT_TRUE(catcher.GetNextResult());
655 } 655 }
656 656
657 } // namespace 657 } // namespace
658 } // namespace extensions 658 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | chrome/browser/notifications/notification_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698