| 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 "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/pref_service.h" | 7 #include "chrome/browser/pref_service.h" |
| 8 #include "chrome/browser/pref_value_store.h" | 8 #include "chrome/browser/pref_value_store.h" |
| 9 #include "chrome/browser/renderer_host/render_view_host.h" | 9 #include "chrome/browser/renderer_host/render_view_host.h" |
| 10 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 10 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 params->searchable_form_encoding = std::string(); | 36 params->searchable_form_encoding = std::string(); |
| 37 params->password_form = PasswordForm(); | 37 params->password_form = PasswordForm(); |
| 38 params->security_info = std::string(); | 38 params->security_info = std::string(); |
| 39 params->gesture = NavigationGestureUser; | 39 params->gesture = NavigationGestureUser; |
| 40 params->is_post = false; | 40 params->is_post = false; |
| 41 } | 41 } |
| 42 | 42 |
| 43 // Subclass the TestingProfile so that it can return certain services we need. | 43 // Subclass the TestingProfile so that it can return certain services we need. |
| 44 class TabContentsTestingProfile : public TestingProfile { | 44 class TabContentsTestingProfile : public TestingProfile { |
| 45 public: | 45 public: |
| 46 TabContentsTestingProfile() : TestingProfile() { | 46 TabContentsTestingProfile() : TestingProfile() { } |
| 47 CreateBookmarkModel(false); | |
| 48 } | |
| 49 | 47 |
| 50 virtual PrefService* GetPrefs() { | 48 virtual PrefService* GetPrefs() { |
| 51 if (!prefs_.get()) { | 49 if (!prefs_.get()) { |
| 52 FilePath source_path; | 50 FilePath source_path; |
| 53 PathService::Get(chrome::DIR_TEST_DATA, &source_path); | 51 PathService::Get(chrome::DIR_TEST_DATA, &source_path); |
| 54 source_path = source_path.AppendASCII("profiles") | 52 source_path = source_path.AppendASCII("profiles") |
| 55 .AppendASCII("chrome_prefs").AppendASCII("Preferences"); | 53 .AppendASCII("chrome_prefs").AppendASCII("Preferences"); |
| 56 | 54 |
| 57 // Create a preference service that only contains user defined | 55 // Create a preference service that only contains user defined |
| 58 // preference values. | 56 // preference values. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 public: | 197 public: |
| 200 TabContentsTest() | 198 TabContentsTest() |
| 201 : RenderViewHostTestHarness(), | 199 : RenderViewHostTestHarness(), |
| 202 ui_thread_(ChromeThread::UI, &message_loop_) { | 200 ui_thread_(ChromeThread::UI, &message_loop_) { |
| 203 } | 201 } |
| 204 | 202 |
| 205 private: | 203 private: |
| 206 // Supply our own profile so we use the correct profile data. The test harness | 204 // Supply our own profile so we use the correct profile data. The test harness |
| 207 // is not supposed to overwrite a profile if it's already created. | 205 // is not supposed to overwrite a profile if it's already created. |
| 208 virtual void SetUp() { | 206 virtual void SetUp() { |
| 209 TestingProfile* profile = new TestingProfile(); | 207 profile_.reset(new TabContentsTestingProfile()); |
| 210 profile_.reset(profile); | |
| 211 | 208 |
| 212 RenderViewHostTestHarness::SetUp(); | 209 RenderViewHostTestHarness::SetUp(); |
| 213 } | 210 } |
| 214 | 211 |
| 215 virtual void TearDown() { | 212 virtual void TearDown() { |
| 216 RenderViewHostTestHarness::TearDown(); | 213 RenderViewHostTestHarness::TearDown(); |
| 217 | 214 |
| 218 profile_.reset(NULL); | 215 profile_.reset(NULL); |
| 219 } | 216 } |
| 220 | 217 |
| (...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 | 1467 |
| 1471 // While the interstitial is showing, let's simulate the hidden page | 1468 // While the interstitial is showing, let's simulate the hidden page |
| 1472 // attempting to show a JS message. | 1469 // attempting to show a JS message. |
| 1473 IPC::Message* dummy_message = new IPC::Message; | 1470 IPC::Message* dummy_message = new IPC::Message; |
| 1474 bool did_suppress_message = false; | 1471 bool did_suppress_message = false; |
| 1475 contents()->RunJavaScriptMessage(L"This is an informative message", L"OK", | 1472 contents()->RunJavaScriptMessage(L"This is an informative message", L"OK", |
| 1476 kGURL, MessageBoxFlags::kIsJavascriptAlert, dummy_message, | 1473 kGURL, MessageBoxFlags::kIsJavascriptAlert, dummy_message, |
| 1477 &did_suppress_message); | 1474 &did_suppress_message); |
| 1478 EXPECT_TRUE(did_suppress_message); | 1475 EXPECT_TRUE(did_suppress_message); |
| 1479 } | 1476 } |
| OLD | NEW |