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

Side by Side Diff: chrome/browser/infobars/infobars_browsertest.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 "chrome/browser/extensions/crx_installer.h" 5 #include "chrome/browser/extensions/crx_installer.h"
6 #include "chrome/browser/extensions/extension_install_prompt.h" 6 #include "chrome/browser/extensions/extension_install_prompt.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/infobars/infobar_tab_helper.h" 8 #include "chrome/browser/infobars/infobar_tab_helper.h"
9 #include "chrome/browser/themes/theme_service.h" 9 #include "chrome/browser/themes/theme_service.h"
10 #include "chrome/browser/themes/theme_service_factory.h" 10 #include "chrome/browser/themes/theme_service_factory.h"
(...skipping 17 matching lines...) Expand all
28 command_line->AppendSwitchASCII( 28 command_line->AppendSwitchASCII(
29 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); 29 switches::kAppsGalleryInstallAutoConfirmForTests, "accept");
30 } 30 }
31 31
32 void InstallExtension(const char* filename) { 32 void InstallExtension(const char* filename) {
33 FilePath path = ui_test_utils::GetTestFilePath( 33 FilePath path = ui_test_utils::GetTestFilePath(
34 FilePath().AppendASCII("extensions"), FilePath().AppendASCII(filename)); 34 FilePath().AppendASCII("extensions"), FilePath().AppendASCII(filename));
35 Profile* profile = browser()->profile(); 35 Profile* profile = browser()->profile();
36 ExtensionService* service = profile->GetExtensionService(); 36 ExtensionService* service = profile->GetExtensionService();
37 37
38 ui_test_utils::WindowedNotificationObserver observer( 38 content::WindowedNotificationObserver observer(
39 chrome::NOTIFICATION_EXTENSION_LOADED, 39 chrome::NOTIFICATION_EXTENSION_LOADED,
40 content::NotificationService::AllSources()); 40 content::NotificationService::AllSources());
41 41
42 ExtensionInstallPrompt* client = 42 ExtensionInstallPrompt* client =
43 chrome::CreateExtensionInstallPromptWithBrowser(browser()); 43 chrome::CreateExtensionInstallPromptWithBrowser(browser());
44 scoped_refptr<CrxInstaller> installer( 44 scoped_refptr<CrxInstaller> installer(
45 CrxInstaller::Create(service, client)); 45 CrxInstaller::Create(service, client));
46 installer->set_install_cause(extension_misc::INSTALL_CAUSE_AUTOMATION); 46 installer->set_install_cause(extension_misc::INSTALL_CAUSE_AUTOMATION);
47 installer->InstallCrx(path); 47 installer->InstallCrx(path);
48 48
49 observer.Wait(); 49 observer.Wait();
50 } 50 }
51 }; 51 };
52 52
53 IN_PROC_BROWSER_TEST_F(InfoBarsTest, TestInfoBarsCloseOnNewTheme) { 53 IN_PROC_BROWSER_TEST_F(InfoBarsTest, TestInfoBarsCloseOnNewTheme) {
54 ASSERT_TRUE(test_server()->Start()); 54 ASSERT_TRUE(test_server()->Start());
55 55
56 ui_test_utils::NavigateToURL( 56 ui_test_utils::NavigateToURL(
57 browser(), test_server()->GetURL("files/simple.html")); 57 browser(), test_server()->GetURL("files/simple.html"));
58 58
59 ui_test_utils::WindowedNotificationObserver infobar_added_1( 59 content::WindowedNotificationObserver infobar_added_1(
60 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, 60 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
61 content::NotificationService::AllSources()); 61 content::NotificationService::AllSources());
62 InstallExtension("theme.crx"); 62 InstallExtension("theme.crx");
63 infobar_added_1.Wait(); 63 infobar_added_1.Wait();
64 64
65 ui_test_utils::NavigateToURLWithDisposition( 65 ui_test_utils::NavigateToURLWithDisposition(
66 browser(), test_server()->GetURL("files/simple.html"), 66 browser(), test_server()->GetURL("files/simple.html"),
67 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 67 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
68 ui_test_utils::WindowedNotificationObserver infobar_added_2( 68 content::WindowedNotificationObserver infobar_added_2(
69 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, 69 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
70 content::NotificationService::AllSources()); 70 content::NotificationService::AllSources());
71 ui_test_utils::WindowedNotificationObserver infobar_removed_1( 71 content::WindowedNotificationObserver infobar_removed_1(
72 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, 72 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED,
73 content::NotificationService::AllSources()); 73 content::NotificationService::AllSources());
74 InstallExtension("theme2.crx"); 74 InstallExtension("theme2.crx");
75 infobar_added_2.Wait(); 75 infobar_added_2.Wait();
76 infobar_removed_1.Wait(); 76 infobar_removed_1.Wait();
77 EXPECT_EQ(0u, 77 EXPECT_EQ(0u,
78 chrome::GetTabContentsAt(browser(), 0)->infobar_tab_helper()-> 78 chrome::GetTabContentsAt(browser(), 0)->infobar_tab_helper()->
79 infobar_count()); 79 infobar_count());
80 80
81 ui_test_utils::WindowedNotificationObserver infobar_removed_2( 81 content::WindowedNotificationObserver infobar_removed_2(
82 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, 82 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED,
83 content::NotificationService::AllSources()); 83 content::NotificationService::AllSources());
84 ThemeServiceFactory::GetForProfile(browser()->profile())->UseDefaultTheme(); 84 ThemeServiceFactory::GetForProfile(browser()->profile())->UseDefaultTheme();
85 infobar_removed_2.Wait(); 85 infobar_removed_2.Wait();
86 EXPECT_EQ(0u, 86 EXPECT_EQ(0u,
87 chrome::GetActiveTabContents(browser())->infobar_tab_helper()-> 87 chrome::GetActiveTabContents(browser())->infobar_tab_helper()->
88 infobar_count()); 88 infobar_count());
89 } 89 }
OLDNEW
« no previous file with comments | « chrome/browser/history/top_sites_unittest.cc ('k') | chrome/browser/instant/instant_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698