| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "chrome/browser/renderer_host/render_view_host.h" | 6 #include "chrome/browser/renderer_host/render_view_host.h" |
| 7 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 8 #include "chrome/browser/renderer_host/test_render_view_host.h" | 8 #include "chrome/browser/renderer_host/test_render_view_host.h" |
| 9 #include "chrome/browser/tab_contents/interstitial_page.h" | 9 #include "chrome/browser/tab_contents/interstitial_page.h" |
| 10 #include "chrome/browser/tab_contents/navigation_controller.h" | 10 #include "chrome/browser/tab_contents/navigation_controller.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 params->is_post = false; | 35 params->is_post = false; |
| 36 } | 36 } |
| 37 | 37 |
| 38 // Subclass the TestingProfile so that it can return certain services we need. | 38 // Subclass the TestingProfile so that it can return certain services we need. |
| 39 class WebContentsTestingProfile : public TestingProfile { | 39 class WebContentsTestingProfile : public TestingProfile { |
| 40 public: | 40 public: |
| 41 WebContentsTestingProfile() : TestingProfile() { } | 41 WebContentsTestingProfile() : TestingProfile() { } |
| 42 | 42 |
| 43 virtual PrefService* GetPrefs() { | 43 virtual PrefService* GetPrefs() { |
| 44 if (!prefs_.get()) { | 44 if (!prefs_.get()) { |
| 45 std::wstring source_path; | 45 FilePath source_path; |
| 46 PathService::Get(chrome::DIR_TEST_DATA, &source_path); | 46 PathService::Get(chrome::DIR_TEST_DATA, &source_path); |
| 47 file_util::AppendToPath(&source_path, L"profiles"); | 47 source_path = source_path.AppendASCII("profiles") |
| 48 file_util::AppendToPath(&source_path, L"chrome_prefs"); | 48 .AppendASCII("chrome_prefs").AppendASCII("Preferences"); |
| 49 file_util::AppendToPath(&source_path, L"Preferences"); | |
| 50 | 49 |
| 51 prefs_.reset(new PrefService(source_path)); | 50 prefs_.reset(new PrefService(source_path)); |
| 52 Profile::RegisterUserPrefs(prefs_.get()); | 51 Profile::RegisterUserPrefs(prefs_.get()); |
| 53 browser::RegisterAllPrefs(prefs_.get(), prefs_.get()); | 52 browser::RegisterAllPrefs(prefs_.get(), prefs_.get()); |
| 54 } | 53 } |
| 55 return prefs_.get(); | 54 return prefs_.get(); |
| 56 } | 55 } |
| 57 }; | 56 }; |
| 58 | 57 |
| 59 class TestInterstitialPage : public InterstitialPage { | 58 class TestInterstitialPage : public InterstitialPage { |
| (...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 interstitial = | 1040 interstitial = |
| 1042 new TestInterstitialPage(contents(), true, url, &state, &deleted); | 1041 new TestInterstitialPage(contents(), true, url, &state, &deleted); |
| 1043 interstitial->Show(); | 1042 interstitial->Show(); |
| 1044 interstitial->TestDidNavigate(1, url); | 1043 interstitial->TestDidNavigate(1, url); |
| 1045 // Simulate a renderer crash. | 1044 // Simulate a renderer crash. |
| 1046 interstitial->TestRenderViewGone(); | 1045 interstitial->TestRenderViewGone(); |
| 1047 // The interstitial should have been dismissed. | 1046 // The interstitial should have been dismissed. |
| 1048 EXPECT_TRUE(deleted); | 1047 EXPECT_TRUE(deleted); |
| 1049 EXPECT_EQ(TestInterstitialPage::CANCELED, state); | 1048 EXPECT_EQ(TestInterstitialPage::CANCELED, state); |
| 1050 } | 1049 } |
| OLD | NEW |