OLD | NEW |
1 // Copyright (c) 2010 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/browser_thread.h" | 9 #include "chrome/browser/browser_thread.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
11 #include "chrome/browser/prefs/pref_value_store.h" | 11 #include "chrome/browser/prefs/pref_value_store.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 Value::CreateBooleanValue(false)); | 206 Value::CreateBooleanValue(false)); |
207 #endif | 207 #endif |
208 pref_services->SetUserPref(prefs::kDefaultCharset, | 208 pref_services->SetUserPref(prefs::kDefaultCharset, |
209 Value::CreateStringValue("utf8")); | 209 Value::CreateStringValue("utf8")); |
210 pref_services->SetUserPref(prefs::kWebKitDefaultFontSize, | 210 pref_services->SetUserPref(prefs::kWebKitDefaultFontSize, |
211 Value::CreateIntegerValue(20)); | 211 Value::CreateIntegerValue(20)); |
212 pref_services->SetUserPref(prefs::kWebKitTextAreasAreResizable, | 212 pref_services->SetUserPref(prefs::kWebKitTextAreasAreResizable, |
213 Value::CreateBooleanValue(false)); | 213 Value::CreateBooleanValue(false)); |
214 pref_services->SetUserPref(prefs::kWebKitUsesUniversalDetector, | 214 pref_services->SetUserPref(prefs::kWebKitUsesUniversalDetector, |
215 Value::CreateBooleanValue(true)); | 215 Value::CreateBooleanValue(true)); |
216 pref_services->SetUserPref(prefs::kWebKitStandardFontIsSerif, | |
217 Value::CreateBooleanValue(true)); | |
218 pref_services->SetUserPref("webkit.webprefs.foo", | 216 pref_services->SetUserPref("webkit.webprefs.foo", |
219 Value::CreateStringValue("bar")); | 217 Value::CreateStringValue("bar")); |
220 | 218 |
221 RenderViewHostTestHarness::SetUp(); | 219 RenderViewHostTestHarness::SetUp(); |
222 } | 220 } |
223 | 221 |
224 virtual void TearDown() { | 222 virtual void TearDown() { |
225 RenderViewHostTestHarness::TearDown(); | 223 RenderViewHostTestHarness::TearDown(); |
226 | 224 |
227 profile_.reset(NULL); | 225 profile_.reset(NULL); |
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 | 1614 |
1617 // And the interstitial should be showing. | 1615 // And the interstitial should be showing. |
1618 EXPECT_TRUE(other_contents->showing_interstitial_page()); | 1616 EXPECT_TRUE(other_contents->showing_interstitial_page()); |
1619 | 1617 |
1620 // And the interstitial should do a reload on don't proceed. | 1618 // And the interstitial should do a reload on don't proceed. |
1621 EXPECT_TRUE(other_contents->interstitial_page()->reload_on_dont_proceed()); | 1619 EXPECT_TRUE(other_contents->interstitial_page()->reload_on_dont_proceed()); |
1622 } | 1620 } |
1623 | 1621 |
1624 class ConstrainedWindowCloseTest : public ConstrainedWindow { | 1622 class ConstrainedWindowCloseTest : public ConstrainedWindow { |
1625 public: | 1623 public: |
1626 ConstrainedWindowCloseTest(TabContents* tab_contents) | 1624 explicit ConstrainedWindowCloseTest(TabContents* tab_contents) |
1627 : tab_contents_(tab_contents) { | 1625 : tab_contents_(tab_contents) { |
1628 } | 1626 } |
1629 | 1627 |
1630 virtual void ShowConstrainedWindow() {} | 1628 virtual void ShowConstrainedWindow() {} |
1631 virtual void FocusConstrainedWindow() {} | 1629 virtual void FocusConstrainedWindow() {} |
1632 virtual ~ConstrainedWindowCloseTest() {} | 1630 virtual ~ConstrainedWindowCloseTest() {} |
1633 | 1631 |
1634 virtual void CloseConstrainedWindow() { | 1632 virtual void CloseConstrainedWindow() { |
1635 tab_contents_->WillClose(this); | 1633 tab_contents_->WillClose(this); |
1636 close_count++; | 1634 close_count++; |
1637 } | 1635 } |
1638 | 1636 |
1639 int close_count; | 1637 int close_count; |
1640 TabContents* tab_contents_; | 1638 TabContents* tab_contents_; |
1641 }; | 1639 }; |
1642 | 1640 |
1643 TEST_F(TabContentsTest, ConstrainedWindows) { | 1641 TEST_F(TabContentsTest, ConstrainedWindows) { |
1644 TabContents* tab_contents = CreateTestTabContents(); | 1642 TabContents* tab_contents = CreateTestTabContents(); |
1645 ConstrainedWindowCloseTest window(tab_contents); | 1643 ConstrainedWindowCloseTest window(tab_contents); |
1646 window.close_count = 0; | 1644 window.close_count = 0; |
1647 | 1645 |
1648 const int kWindowCount = 4; | 1646 const int kWindowCount = 4; |
1649 for (int i = 0; i < kWindowCount; i++) { | 1647 for (int i = 0; i < kWindowCount; i++) { |
1650 tab_contents->AddConstrainedDialog(&window); | 1648 tab_contents->AddConstrainedDialog(&window); |
1651 } | 1649 } |
1652 EXPECT_EQ(window.close_count, 0); | 1650 EXPECT_EQ(window.close_count, 0); |
1653 delete tab_contents; | 1651 delete tab_contents; |
1654 EXPECT_EQ(window.close_count, kWindowCount); | 1652 EXPECT_EQ(window.close_count, kWindowCount); |
1655 } | 1653 } |
OLD | NEW |