OLD | NEW |
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 <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/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
10 #include "chrome/browser/prefs/pref_value_store.h" | 10 #include "chrome/browser/prefs/pref_value_store.h" |
(...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1517 TestInterstitialPage* interstitial = | 1517 TestInterstitialPage* interstitial = |
1518 new TestInterstitialPage(contents(), true, kGURL, &state, &deleted); | 1518 new TestInterstitialPage(contents(), true, kGURL, &state, &deleted); |
1519 TestInterstitialPageStateGuard state_guard(interstitial); | 1519 TestInterstitialPageStateGuard state_guard(interstitial); |
1520 interstitial->Show(); | 1520 interstitial->Show(); |
1521 interstitial->TestDidNavigate(1, kGURL); | 1521 interstitial->TestDidNavigate(1, kGURL); |
1522 | 1522 |
1523 // While the interstitial is showing, let's simulate the hidden page | 1523 // While the interstitial is showing, let's simulate the hidden page |
1524 // attempting to show a JS message. | 1524 // attempting to show a JS message. |
1525 IPC::Message* dummy_message = new IPC::Message; | 1525 IPC::Message* dummy_message = new IPC::Message; |
1526 bool did_suppress_message = false; | 1526 bool did_suppress_message = false; |
| 1527 const bool unload_handler_being_run = false; |
1527 contents()->RunJavaScriptMessage(L"This is an informative message", L"OK", | 1528 contents()->RunJavaScriptMessage(L"This is an informative message", L"OK", |
1528 kGURL, ui::MessageBoxFlags::kIsJavascriptAlert, dummy_message, | 1529 kGURL, ui::MessageBoxFlags::kIsJavascriptAlert, unload_handler_being_run, |
1529 &did_suppress_message); | 1530 dummy_message, &did_suppress_message); |
1530 EXPECT_TRUE(did_suppress_message); | 1531 EXPECT_TRUE(did_suppress_message); |
1531 } | 1532 } |
1532 | 1533 |
1533 // Makes sure that if the source passed to CopyStateFromAndPrune has an | 1534 // Makes sure that if the source passed to CopyStateFromAndPrune has an |
1534 // interstitial it isn't copied over to the destination. | 1535 // interstitial it isn't copied over to the destination. |
1535 TEST_F(TabContentsTest, CopyStateFromAndPruneSourceInterstitial) { | 1536 TEST_F(TabContentsTest, CopyStateFromAndPruneSourceInterstitial) { |
1536 // Navigate to a page. | 1537 // Navigate to a page. |
1537 GURL url1("http://www.google.com"); | 1538 GURL url1("http://www.google.com"); |
1538 rvh()->SendNavigate(1, url1); | 1539 rvh()->SendNavigate(1, url1); |
1539 EXPECT_EQ(1, controller().entry_count()); | 1540 EXPECT_EQ(1, controller().entry_count()); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1644 window.close_count = 0; | 1645 window.close_count = 0; |
1645 | 1646 |
1646 const int kWindowCount = 4; | 1647 const int kWindowCount = 4; |
1647 for (int i = 0; i < kWindowCount; i++) { | 1648 for (int i = 0; i < kWindowCount; i++) { |
1648 tab_contents->AddConstrainedDialog(&window); | 1649 tab_contents->AddConstrainedDialog(&window); |
1649 } | 1650 } |
1650 EXPECT_EQ(window.close_count, 0); | 1651 EXPECT_EQ(window.close_count, 0); |
1651 delete tab_contents; | 1652 delete tab_contents; |
1652 EXPECT_EQ(window.close_count, kWindowCount); | 1653 EXPECT_EQ(window.close_count, kWindowCount); |
1653 } | 1654 } |
OLD | NEW |