| OLD | NEW |
| 1 // Copyright (c) 2010 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "app/message_box_flags.h" | 7 #include "app/message_box_flags.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/pref_service.h" | 10 #include "chrome/browser/pref_service.h" |
| 11 #include "chrome/browser/pref_value_store.h" | 11 #include "chrome/browser/pref_value_store.h" |
| 12 #include "chrome/browser/renderer_host/render_view_host.h" | 12 #include "chrome/browser/renderer_host/render_view_host.h" |
| 13 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 13 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 14 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | 14 #include "chrome/browser/renderer_host/test/test_render_view_host.h" |
| 15 #include "chrome/browser/chrome_thread.h" | 15 #include "chrome/browser/chrome_thread.h" |
| 16 #include "chrome/browser/tab_contents/interstitial_page.h" | 16 #include "chrome/browser/tab_contents/interstitial_page.h" |
| 17 #include "chrome/browser/tab_contents/navigation_controller.h" | 17 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 18 #include "chrome/browser/tab_contents/navigation_entry.h" | 18 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 19 #include "chrome/browser/tab_contents/test_tab_contents.h" | 19 #include "chrome/browser/tab_contents/test_tab_contents.h" |
| 20 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 22 #include "chrome/common/render_messages.h" | 22 #include "chrome/common/render_messages.h" |
| 23 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
| 24 #include "chrome/test/testing_pref_service.h" |
| 24 #include "chrome/test/testing_profile.h" | 25 #include "chrome/test/testing_profile.h" |
| 25 #include "ipc/ipc_channel.h" | 26 #include "ipc/ipc_channel.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 28 |
| 28 using webkit_glue::PasswordForm; | 29 using webkit_glue::PasswordForm; |
| 29 | 30 |
| 30 static void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, | 31 static void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, |
| 31 int page_id, | 32 int page_id, |
| 32 const GURL& url) { | 33 const GURL& url) { |
| 33 params->page_id = page_id; | 34 params->page_id = page_id; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 187 } |
| 187 | 188 |
| 188 private: | 189 private: |
| 189 // Supply our own profile so we use the correct profile data. The test harness | 190 // Supply our own profile so we use the correct profile data. The test harness |
| 190 // is not supposed to overwrite a profile if it's already created. | 191 // is not supposed to overwrite a profile if it's already created. |
| 191 virtual void SetUp() { | 192 virtual void SetUp() { |
| 192 TestingProfile* profile = new TestingProfile(); | 193 TestingProfile* profile = new TestingProfile(); |
| 193 profile_.reset(profile); | 194 profile_.reset(profile); |
| 194 | 195 |
| 195 // Set some (WebKit) user preferences. | 196 // Set some (WebKit) user preferences. |
| 196 TestingPrefService* pref_services = profile->GetPrefs(); | 197 TestingPrefService* pref_services = profile->GetTestingPrefService(); |
| 197 #if defined(TOOLKIT_USES_GTK) | 198 #if defined(TOOLKIT_USES_GTK) |
| 198 pref_services->SetUserPref(prefs::kUsesSystemTheme, | 199 pref_services->SetUserPref(prefs::kUsesSystemTheme, |
| 199 Value::CreateBooleanValue(false)); | 200 Value::CreateBooleanValue(false)); |
| 200 #endif | 201 #endif |
| 201 pref_services->SetUserPref(prefs::kDefaultCharset, | 202 pref_services->SetUserPref(prefs::kDefaultCharset, |
| 202 Value::CreateStringValue("utf8")); | 203 Value::CreateStringValue("utf8")); |
| 203 pref_services->SetUserPref(prefs::kWebKitDefaultFontSize, | 204 pref_services->SetUserPref(prefs::kWebKitDefaultFontSize, |
| 204 Value::CreateIntegerValue(20)); | 205 Value::CreateIntegerValue(20)); |
| 205 pref_services->SetUserPref(prefs::kWebKitTextAreasAreResizable, | 206 pref_services->SetUserPref(prefs::kWebKitTextAreasAreResizable, |
| 206 Value::CreateBooleanValue(false)); | 207 Value::CreateBooleanValue(false)); |
| (...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 | 1473 |
| 1473 // While the interstitial is showing, let's simulate the hidden page | 1474 // While the interstitial is showing, let's simulate the hidden page |
| 1474 // attempting to show a JS message. | 1475 // attempting to show a JS message. |
| 1475 IPC::Message* dummy_message = new IPC::Message; | 1476 IPC::Message* dummy_message = new IPC::Message; |
| 1476 bool did_suppress_message = false; | 1477 bool did_suppress_message = false; |
| 1477 contents()->RunJavaScriptMessage(L"This is an informative message", L"OK", | 1478 contents()->RunJavaScriptMessage(L"This is an informative message", L"OK", |
| 1478 kGURL, MessageBoxFlags::kIsJavascriptAlert, dummy_message, | 1479 kGURL, MessageBoxFlags::kIsJavascriptAlert, dummy_message, |
| 1479 &did_suppress_message); | 1480 &did_suppress_message); |
| 1480 EXPECT_TRUE(did_suppress_message); | 1481 EXPECT_TRUE(did_suppress_message); |
| 1481 } | 1482 } |
| OLD | NEW |