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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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
« no previous file with comments | « chrome/browser/bookmarks/bookmark_utils.cc ('k') | chrome/browser/browser_focus_uitest.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/sys_info.h" 9 #include "base/sys_info.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/app/chrome_command_ids.h" 11 #include "chrome/app/chrome_command_ids.h"
12 #include "chrome/browser/defaults.h" 12 #include "chrome/browser/defaults.h"
13 #include "chrome/browser/extensions/extension_browsertest.h" 13 #include "chrome/browser/extensions/extension_browsertest.h"
14 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/extensions/extension_tab_helper.h" 15 #include "chrome/browser/extensions/extension_tab_helper.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/tabs/pinned_tab_codec.h" 17 #include "chrome/browser/tabs/pinned_tab_codec.h"
18 #include "chrome/browser/tabs/tab_strip_model.h" 18 #include "chrome/browser/tabs/tab_strip_model.h"
19 #include "chrome/browser/translate/translate_tab_helper.h" 19 #include "chrome/browser/translate/translate_tab_helper.h"
20 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" 20 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
21 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" 21 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h"
22 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" 22 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
23 #include "chrome/browser/ui/browser.h" 23 #include "chrome/browser/ui/browser.h"
24 #include "chrome/browser/ui/browser_init.h" 24 #include "chrome/browser/ui/browser_init.h"
25 #include "chrome/browser/ui/browser_list.h" 25 #include "chrome/browser/ui/browser_list.h"
26 #include "chrome/browser/ui/browser_navigator.h" 26 #include "chrome/browser/ui/browser_navigator.h"
27 #include "chrome/browser/ui/browser_window.h" 27 #include "chrome/browser/ui/browser_window.h"
28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
29 #include "chrome/common/chrome_notification_types.h"
29 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/extensions/extension.h" 31 #include "chrome/common/extensions/extension.h"
31 #include "chrome/common/url_constants.h" 32 #include "chrome/common/url_constants.h"
32 #include "chrome/test/in_process_browser_test.h" 33 #include "chrome/test/in_process_browser_test.h"
33 #include "chrome/test/ui_test_utils.h" 34 #include "chrome/test/ui_test_utils.h"
34 #include "content/browser/renderer_host/render_process_host.h" 35 #include "content/browser/renderer_host/render_process_host.h"
35 #include "content/browser/renderer_host/render_view_host.h" 36 #include "content/browser/renderer_host/render_view_host.h"
36 #include "content/browser/tab_contents/tab_contents.h" 37 #include "content/browser/tab_contents/tab_contents.h"
37 #include "content/common/notification_source.h" 38 #include "content/common/notification_source.h"
38 #include "content/common/notification_type.h"
39 #include "content/common/page_transition_types.h" 39 #include "content/common/page_transition_types.h"
40 #include "grit/chromium_strings.h" 40 #include "grit/chromium_strings.h"
41 #include "grit/generated_resources.h" 41 #include "grit/generated_resources.h"
42 #include "net/base/mock_host_resolver.h" 42 #include "net/base/mock_host_resolver.h"
43 #include "net/test/test_server.h" 43 #include "net/test/test_server.h"
44 #include "ui/base/l10n/l10n_util.h" 44 #include "ui/base/l10n/l10n_util.h"
45 45
46 #if defined(OS_WIN) 46 #if defined(OS_WIN)
47 #include "base/i18n/rtl.h" 47 #include "base/i18n/rtl.h"
48 #include "chrome/browser/browser_process.h" 48 #include "chrome/browser/browser_process.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 browser()->OpenURL(url2, GURL(), CURRENT_TAB, PageTransition::TYPED); 292 browser()->OpenURL(url2, GURL(), CURRENT_TAB, PageTransition::TYPED);
293 293
294 // Cancel the dialog. 294 // Cancel the dialog.
295 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); 295 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
296 alert->CloseModalDialog(); 296 alert->CloseModalDialog();
297 EXPECT_FALSE(browser()->GetSelectedTabContents()->is_loading()); 297 EXPECT_FALSE(browser()->GetSelectedTabContents()->is_loading());
298 298
299 // Wait for the ShouldClose_ACK to arrive. We can detect it by waiting for 299 // Wait for the ShouldClose_ACK to arrive. We can detect it by waiting for
300 // the pending RVH to be destroyed. 300 // the pending RVH to be destroyed.
301 ui_test_utils::WaitForNotification( 301 ui_test_utils::WaitForNotification(
302 NotificationType::RENDER_WIDGET_HOST_DESTROYED); 302 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED);
303 EXPECT_EQ(url.spec(), WideToUTF8(browser()->toolbar_model()->GetText())); 303 EXPECT_EQ(url.spec(), WideToUTF8(browser()->toolbar_model()->GetText()));
304 304
305 // Clear the beforeunload handler so the test can easily exit. 305 // Clear the beforeunload handler so the test can easily exit.
306 browser()->GetSelectedTabContents()->render_view_host()-> 306 browser()->GetSelectedTabContents()->render_view_host()->
307 ExecuteJavascriptInWebFrame(string16(), 307 ExecuteJavascriptInWebFrame(string16(),
308 ASCIIToUTF16("onbeforeunload=null;")); 308 ASCIIToUTF16("onbeforeunload=null;"));
309 } 309 }
310 310
311 // Crashy on mac. http://crbug.com/38522 311 // Crashy on mac. http://crbug.com/38522
312 #if defined(OS_MACOSX) 312 #if defined(OS_MACOSX)
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 // Open a new tab with a page in English. 605 // Open a new tab with a page in English.
606 AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")), 606 AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")),
607 PageTransition::TYPED); 607 PageTransition::TYPED);
608 608
609 TabContents* current_tab = browser()->GetSelectedTabContents(); 609 TabContents* current_tab = browser()->GetSelectedTabContents();
610 TabContentsWrapper* wrapper = browser()->GetSelectedTabContentsWrapper(); 610 TabContentsWrapper* wrapper = browser()->GetSelectedTabContentsWrapper();
611 TranslateTabHelper* helper = wrapper->translate_tab_helper(); 611 TranslateTabHelper* helper = wrapper->translate_tab_helper();
612 Source<TabContents> source(current_tab); 612 Source<TabContents> source(current_tab);
613 613
614 ui_test_utils::WindowedNotificationObserverWithDetails<std::string> 614 ui_test_utils::WindowedNotificationObserverWithDetails<std::string>
615 en_language_detected_signal(NotificationType::TAB_LANGUAGE_DETERMINED, 615 en_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
616 source); 616 source);
617 EXPECT_EQ("", helper->language_state().original_language()); 617 EXPECT_EQ("", helper->language_state().original_language());
618 en_language_detected_signal.Wait(); 618 en_language_detected_signal.Wait();
619 EXPECT_TRUE(en_language_detected_signal.GetDetailsFor( 619 EXPECT_TRUE(en_language_detected_signal.GetDetailsFor(
620 source.map_key(), &lang)); 620 source.map_key(), &lang));
621 EXPECT_EQ("en", lang); 621 EXPECT_EQ("en", lang);
622 EXPECT_EQ("en", helper->language_state().original_language()); 622 EXPECT_EQ("en", helper->language_state().original_language());
623 623
624 // Now navigate to a page in French. 624 // Now navigate to a page in French.
625 ui_test_utils::WindowedNotificationObserverWithDetails<std::string> 625 ui_test_utils::WindowedNotificationObserverWithDetails<std::string>
626 fr_language_detected_signal(NotificationType::TAB_LANGUAGE_DETERMINED, 626 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
627 source); 627 source);
628 ui_test_utils::NavigateToURL( 628 ui_test_utils::NavigateToURL(
629 browser(), GURL(test_server()->GetURL("files/french_page.html"))); 629 browser(), GURL(test_server()->GetURL("files/french_page.html")));
630 fr_language_detected_signal.Wait(); 630 fr_language_detected_signal.Wait();
631 lang.clear(); 631 lang.clear();
632 EXPECT_TRUE(fr_language_detected_signal.GetDetailsFor( 632 EXPECT_TRUE(fr_language_detected_signal.GetDetailsFor(
633 source.map_key(), &lang)); 633 source.map_key(), &lang));
634 EXPECT_EQ("fr", lang); 634 EXPECT_EQ("fr", lang);
635 EXPECT_EQ("fr", helper->language_state().original_language()); 635 EXPECT_EQ("fr", helper->language_state().original_language());
636 } 636 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 848
849 // The normal browser should now have four. 849 // The normal browser should now have four.
850 EXPECT_EQ(4, browser()->tab_count()); 850 EXPECT_EQ(4, browser()->tab_count());
851 851
852 // Close the additional browsers. 852 // Close the additional browsers.
853 popup_browser->CloseAllTabs(); 853 popup_browser->CloseAllTabs();
854 app_browser->CloseAllTabs(); 854 app_browser->CloseAllTabs();
855 app_popup_browser->CloseAllTabs(); 855 app_popup_browser->CloseAllTabs();
856 } 856 }
857 #endif 857 #endif
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_utils.cc ('k') | chrome/browser/browser_focus_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698