| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/message_box_flags.h" | 5 #include "app/message_box_flags.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "chrome/browser/renderer_host/render_view_host.h" | 7 #include "chrome/browser/renderer_host/render_view_host.h" |
| 8 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 8 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 9 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | 9 #include "chrome/browser/renderer_host/test/test_render_view_host.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| 11 #include "chrome/browser/tab_contents/interstitial_page.h" | 11 #include "chrome/browser/tab_contents/interstitial_page.h" |
| 12 #include "chrome/browser/tab_contents/navigation_controller.h" | 12 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 13 #include "chrome/browser/tab_contents/navigation_entry.h" | 13 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 14 #include "chrome/browser/tab_contents/test_tab_contents.h" | 14 #include "chrome/browser/tab_contents/test_tab_contents.h" |
| 15 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
| 16 #include "chrome/common/pref_service.h" | 16 #include "chrome/common/pref_service.h" |
| 17 #include "chrome/common/render_messages.h" | 17 #include "chrome/common/render_messages.h" |
| 18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 19 #include "chrome/test/testing_profile.h" | 19 #include "chrome/test/testing_profile.h" |
| 20 #include "ipc/ipc_channel.h" | 20 #include "ipc/ipc_channel.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 22 |
| 23 using webkit_glue::PasswordForm; | 23 using webkit_glue::PasswordForm; |
| 24 | 24 |
| 25 static void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, | 25 static void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, |
| 26 int page_id, | 26 int page_id, |
| 27 const GURL& url) { | 27 const GURL& url) { |
| 28 params->page_id = page_id; | 28 params->page_id = page_id; |
| 29 params->url = url; | 29 params->url = url; |
| 30 params->referrer = GURL::EmptyGURL(); | 30 params->referrer = GURL(); |
| 31 params->transition = PageTransition::TYPED; | 31 params->transition = PageTransition::TYPED; |
| 32 params->redirects = std::vector<GURL>(); | 32 params->redirects = std::vector<GURL>(); |
| 33 params->should_update_history = false; | 33 params->should_update_history = false; |
| 34 params->searchable_form_url = GURL::EmptyGURL(); | 34 params->searchable_form_url = GURL(); |
| 35 params->searchable_form_encoding = std::string(); | 35 params->searchable_form_encoding = std::string(); |
| 36 params->password_form = PasswordForm(); | 36 params->password_form = PasswordForm(); |
| 37 params->security_info = std::string(); | 37 params->security_info = std::string(); |
| 38 params->gesture = NavigationGestureUser; | 38 params->gesture = NavigationGestureUser; |
| 39 params->is_post = false; | 39 params->is_post = false; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Subclass the TestingProfile so that it can return certain services we need. | 42 // Subclass the TestingProfile so that it can return certain services we need. |
| 43 class TabContentsTestingProfile : public TestingProfile { | 43 class TabContentsTestingProfile : public TestingProfile { |
| 44 public: | 44 public: |
| (...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 | 1420 |
| 1421 // While the interstitial is showing, let's simulate the hidden page | 1421 // While the interstitial is showing, let's simulate the hidden page |
| 1422 // attempting to show a JS message. | 1422 // attempting to show a JS message. |
| 1423 IPC::Message* dummy_message = new IPC::Message; | 1423 IPC::Message* dummy_message = new IPC::Message; |
| 1424 bool did_suppress_message = false; | 1424 bool did_suppress_message = false; |
| 1425 contents()->RunJavaScriptMessage(L"This is an informative message", L"OK", | 1425 contents()->RunJavaScriptMessage(L"This is an informative message", L"OK", |
| 1426 kGURL, MessageBoxFlags::kIsJavascriptAlert, dummy_message, | 1426 kGURL, MessageBoxFlags::kIsJavascriptAlert, dummy_message, |
| 1427 &did_suppress_message); | 1427 &did_suppress_message); |
| 1428 EXPECT_TRUE(did_suppress_message); | 1428 EXPECT_TRUE(did_suppress_message); |
| 1429 } | 1429 } |
| OLD | NEW |