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

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

Issue 7880003: content: Move constrained window code from TabContents to TabContentsWrapper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Attempt to fix views merge part 2 Created 9 years, 2 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) 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"
11 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
12 #include "chrome/common/render_messages.h" 12 #include "chrome/common/render_messages.h"
13 #include "chrome/common/url_constants.h" 13 #include "chrome/common/url_constants.h"
14 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 14 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
15 #include "chrome/test/base/testing_pref_service.h" 15 #include "chrome/test/base/testing_pref_service.h"
16 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
17 #include "content/browser/browser_thread.h" 17 #include "content/browser/browser_thread.h"
18 #include "content/browser/renderer_host/render_view_host.h" 18 #include "content/browser/renderer_host/render_view_host.h"
19 #include "content/browser/renderer_host/render_widget_host_view.h" 19 #include "content/browser/renderer_host/render_widget_host_view.h"
20 #include "content/browser/site_instance.h" 20 #include "content/browser/site_instance.h"
21 #include "content/browser/tab_contents/constrained_window.h"
22 #include "content/browser/tab_contents/navigation_details.h" 21 #include "content/browser/tab_contents/navigation_details.h"
23 #include "content/browser/tab_contents/navigation_entry.h" 22 #include "content/browser/tab_contents/navigation_entry.h"
24 #include "content/browser/tab_contents/test_tab_contents.h" 23 #include "content/browser/tab_contents/test_tab_contents.h"
25 #include "content/common/bindings_policy.h" 24 #include "content/common/bindings_policy.h"
26 #include "content/common/notification_service.h" 25 #include "content/common/notification_service.h"
27 #include "content/common/notification_source.h" 26 #include "content/common/notification_source.h"
28 #include "content/common/view_messages.h" 27 #include "content/common/view_messages.h"
29 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
30 #include "ui/base/message_box_flags.h" 29 #include "ui/base/message_box_flags.h"
31 #include "webkit/glue/webkit_glue.h" 30 #include "webkit/glue/webkit_glue.h"
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 1761
1763 // It should have a transient entry. 1762 // It should have a transient entry.
1764 EXPECT_TRUE(other_controller.GetTransientEntry()); 1763 EXPECT_TRUE(other_controller.GetTransientEntry());
1765 1764
1766 // And the interstitial should be showing. 1765 // And the interstitial should be showing.
1767 EXPECT_TRUE(other_contents->showing_interstitial_page()); 1766 EXPECT_TRUE(other_contents->showing_interstitial_page());
1768 1767
1769 // And the interstitial should do a reload on don't proceed. 1768 // And the interstitial should do a reload on don't proceed.
1770 EXPECT_TRUE(other_contents->interstitial_page()->reload_on_dont_proceed()); 1769 EXPECT_TRUE(other_contents->interstitial_page()->reload_on_dont_proceed());
1771 } 1770 }
1772
1773 class ConstrainedWindowCloseTest : public ConstrainedWindow {
1774 public:
1775 explicit ConstrainedWindowCloseTest(TabContents* tab_contents)
1776 : tab_contents_(tab_contents) {
1777 }
1778
1779 virtual void ShowConstrainedWindow() {}
1780 virtual void FocusConstrainedWindow() {}
1781 virtual ~ConstrainedWindowCloseTest() {}
1782
1783 virtual void CloseConstrainedWindow() {
1784 tab_contents_->WillClose(this);
1785 close_count++;
1786 }
1787
1788 int close_count;
1789 TabContents* tab_contents_;
1790 };
1791
1792 TEST_F(TabContentsTest, ConstrainedWindows) {
1793 TabContents* tab_contents = CreateTestTabContents();
1794 ConstrainedWindowCloseTest window(tab_contents);
1795 window.close_count = 0;
1796
1797 const int kWindowCount = 4;
1798 for (int i = 0; i < kWindowCount; i++) {
1799 tab_contents->AddConstrainedDialog(&window);
1800 }
1801 EXPECT_EQ(window.close_count, 0);
1802 delete tab_contents;
1803 EXPECT_EQ(window.close_count, kWindowCount);
1804 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698