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

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

Issue 10807047: Create content\public\test\test_utils.h to hold common test classes that are used by unit and brows… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | 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
(...skipping 24 matching lines...) Expand all
35 BrowserActionApiTest() {} 35 BrowserActionApiTest() {}
36 virtual ~BrowserActionApiTest() {} 36 virtual ~BrowserActionApiTest() {}
37 37
38 protected: 38 protected:
39 BrowserActionTestUtil GetBrowserActionsBar() { 39 BrowserActionTestUtil GetBrowserActionsBar() {
40 return BrowserActionTestUtil(browser()); 40 return BrowserActionTestUtil(browser());
41 } 41 }
42 42
43 bool OpenPopup(int index) { 43 bool OpenPopup(int index) {
44 ResultCatcher catcher; 44 ResultCatcher catcher;
45 ui_test_utils::WindowedNotificationObserver popup_observer( 45 content::WindowedNotificationObserver popup_observer(
46 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, 46 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
47 content::NotificationService::AllSources()); 47 content::NotificationService::AllSources());
48 GetBrowserActionsBar().Press(index); 48 GetBrowserActionsBar().Press(index);
49 popup_observer.Wait(); 49 popup_observer.Wait();
50 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 50 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
51 return GetBrowserActionsBar().HasPopup(); 51 return GetBrowserActionsBar().HasPopup();
52 } 52 }
53 }; 53 };
54 54
55 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, Basic) { 55 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, Basic) {
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 "browser_action/close_background"))); 392 "browser_action/close_background")));
393 const Extension* extension = GetSingleLoadedExtension(); 393 const Extension* extension = GetSingleLoadedExtension();
394 394
395 // There is a background page and a browser action with no badge text. 395 // There is a background page and a browser action with no badge text.
396 ExtensionProcessManager* manager = 396 ExtensionProcessManager* manager =
397 browser()->profile()->GetExtensionProcessManager(); 397 browser()->profile()->GetExtensionProcessManager();
398 ASSERT_TRUE(manager->GetBackgroundHostForExtension(extension->id())); 398 ASSERT_TRUE(manager->GetBackgroundHostForExtension(extension->id()));
399 ExtensionAction* action = extension->browser_action(); 399 ExtensionAction* action = extension->browser_action();
400 ASSERT_EQ("", action->GetBadgeText(ExtensionAction::kDefaultTabId)); 400 ASSERT_EQ("", action->GetBadgeText(ExtensionAction::kDefaultTabId));
401 401
402 ui_test_utils::WindowedNotificationObserver host_destroyed_observer( 402 content::WindowedNotificationObserver host_destroyed_observer(
403 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, 403 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
404 content::NotificationService::AllSources()); 404 content::NotificationService::AllSources());
405 405
406 // Click the browser action. 406 // Click the browser action.
407 browser()->profile()->GetExtensionService()->toolbar_model()-> 407 browser()->profile()->GetExtensionService()->toolbar_model()->
408 ExecuteBrowserAction(extension, browser(), NULL); 408 ExecuteBrowserAction(extension, browser(), NULL);
409 409
410 // It can take a moment for the background page to actually get destroyed 410 // It can take a moment for the background page to actually get destroyed
411 // so we wait for the notification before checking that it's really gone 411 // so we wait for the notification before checking that it's really gone
412 // and the badge text has been set. 412 // and the badge text has been set.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 ResultCatcher catcher; 462 ResultCatcher catcher;
463 ui_test_utils::NavigateToURL(browser(), 463 ui_test_utils::NavigateToURL(browser(),
464 GURL(extension->GetResourceURL("update.html"))); 464 GURL(extension->GetResourceURL("update.html")));
465 ASSERT_TRUE(catcher.GetNextResult()); 465 ASSERT_TRUE(catcher.GetNextResult());
466 466
467 // Test the getters for a specific tab. 467 // Test the getters for a specific tab.
468 ui_test_utils::NavigateToURL(browser(), 468 ui_test_utils::NavigateToURL(browser(),
469 GURL(extension->GetResourceURL("update2.html"))); 469 GURL(extension->GetResourceURL("update2.html")));
470 ASSERT_TRUE(catcher.GetNextResult()); 470 ASSERT_TRUE(catcher.GetNextResult());
471 } 471 }
OLDNEW
« no previous file with comments | « chrome/browser/download/save_page_browsertest.cc ('k') | chrome/browser/extensions/api/omnibox/omnibox_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698