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

Side by Side Diff: chrome/browser/tab_contents/web_contents_unittest.cc

Issue 8553001: views: Add an Options enum to MessageBoxView control. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 9 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) 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 "base/logging.h" 5 #include "base/logging.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/dom_operation_notification_details.h" 7 #include "chrome/browser/dom_operation_notification_details.h"
8 #include "chrome/browser/prefs/pref_service.h" 8 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" 9 #include "chrome/browser/tab_contents/chrome_interstitial_page.h"
10 #include "chrome/common/chrome_notification_types.h" 10 #include "chrome/common/chrome_notification_types.h"
(...skipping 10 matching lines...) Expand all
21 #include "content/browser/tab_contents/navigation_entry.h" 21 #include "content/browser/tab_contents/navigation_entry.h"
22 #include "content/browser/tab_contents/test_tab_contents.h" 22 #include "content/browser/tab_contents/test_tab_contents.h"
23 #include "content/common/view_messages.h" 23 #include "content/common/view_messages.h"
24 #include "content/public/browser/notification_details.h" 24 #include "content/public/browser/notification_details.h"
25 #include "content/public/browser/notification_source.h" 25 #include "content/public/browser/notification_source.h"
26 #include "content/public/browser/notification_source.h" 26 #include "content/public/browser/notification_source.h"
27 #include "content/public/common/bindings_policy.h" 27 #include "content/public/common/bindings_policy.h"
28 #include "content/public/common/content_constants.h" 28 #include "content/public/common/content_constants.h"
29 #include "content/test/test_browser_thread.h" 29 #include "content/test/test_browser_thread.h"
30 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
31 #include "ui/base/message_box_flags.h"
32 #include "webkit/glue/webkit_glue.h" 31 #include "webkit/glue/webkit_glue.h"
33 32
34 using content::BrowserThread; 33 using content::BrowserThread;
35 using webkit_glue::PasswordForm; 34 using webkit_glue::PasswordForm;
36 35
37 class TestInterstitialPage : public ChromeInterstitialPage { 36 class TestInterstitialPage : public ChromeInterstitialPage {
38 public: 37 public:
39 enum InterstitialState { 38 enum InterstitialState {
40 UNDECIDED = 0, // No decision taken yet. 39 UNDECIDED = 0, // No decision taken yet.
41 OKED, // Proceed was called. 40 OKED, // Proceed was called.
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 TestInterstitialPageStateGuard state_guard(interstitial); 1706 TestInterstitialPageStateGuard state_guard(interstitial);
1708 interstitial->Show(); 1707 interstitial->Show();
1709 interstitial->TestDidNavigate(1, kGURL); 1708 interstitial->TestDidNavigate(1, kGURL);
1710 1709
1711 // While the interstitial is showing, let's simulate the hidden page 1710 // While the interstitial is showing, let's simulate the hidden page
1712 // attempting to show a JS message. 1711 // attempting to show a JS message.
1713 IPC::Message* dummy_message = new IPC::Message; 1712 IPC::Message* dummy_message = new IPC::Message;
1714 bool did_suppress_message = false; 1713 bool did_suppress_message = false;
1715 contents()->RunJavaScriptMessage(contents()->render_view_host(), 1714 contents()->RunJavaScriptMessage(contents()->render_view_host(),
1716 ASCIIToUTF16("This is an informative message"), ASCIIToUTF16("OK"), 1715 ASCIIToUTF16("This is an informative message"), ASCIIToUTF16("OK"),
1717 kGURL, ui::MessageBoxFlags::kIsJavascriptAlert, dummy_message, 1716 kGURL, ui::JAVASCRIPT_MESSAGE_TYPE_ALERT, dummy_message,
1718 &did_suppress_message); 1717 &did_suppress_message);
1719 EXPECT_TRUE(did_suppress_message); 1718 EXPECT_TRUE(did_suppress_message);
1720 } 1719 }
1721 1720
1722 // Makes sure that if the source passed to CopyStateFromAndPrune has an 1721 // Makes sure that if the source passed to CopyStateFromAndPrune has an
1723 // interstitial it isn't copied over to the destination. 1722 // interstitial it isn't copied over to the destination.
1724 TEST_F(TabContentsTest, CopyStateFromAndPruneSourceInterstitial) { 1723 TEST_F(TabContentsTest, CopyStateFromAndPruneSourceInterstitial) {
1725 // Navigate to a page. 1724 // Navigate to a page.
1726 GURL url1("http://www.google.com"); 1725 GURL url1("http://www.google.com");
1727 rvh()->SendNavigate(1, url1); 1726 rvh()->SendNavigate(1, url1);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 1804
1806 // It should have a transient entry. 1805 // It should have a transient entry.
1807 EXPECT_TRUE(other_controller.GetTransientEntry()); 1806 EXPECT_TRUE(other_controller.GetTransientEntry());
1808 1807
1809 // And the interstitial should be showing. 1808 // And the interstitial should be showing.
1810 EXPECT_TRUE(other_contents->showing_interstitial_page()); 1809 EXPECT_TRUE(other_contents->showing_interstitial_page());
1811 1810
1812 // And the interstitial should do a reload on don't proceed. 1811 // And the interstitial should do a reload on don't proceed.
1813 EXPECT_TRUE(other_contents->interstitial_page()->reload_on_dont_proceed()); 1812 EXPECT_TRUE(other_contents->interstitial_page()->reload_on_dont_proceed());
1814 } 1813 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698