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 "chrome/browser/chromeos/cros/cros_library.h" | 5 #include "chrome/browser/chromeos/cros/cros_library.h" |
6 #include "chrome/browser/chromeos/offline/offline_load_page.h" | 6 #include "chrome/browser/chromeos/offline/offline_load_page.h" |
7 #include "chrome/browser/renderer_host/offline_resource_handler.h" | 7 #include "chrome/browser/renderer_host/offline_resource_handler.h" |
8 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 8 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
9 #include "content/browser/tab_contents/navigation_entry.h" | 9 #include "content/browser/tab_contents/navigation_entry.h" |
10 #include "content/browser/tab_contents/test_tab_contents.h" | 10 #include "content/browser/tab_contents/test_tab_contents.h" |
| 11 #include "content/common/view_messages.h" |
11 #include "content/test/test_browser_thread.h" | 12 #include "content/test/test_browser_thread.h" |
12 | 13 |
13 using content::BrowserThread; | 14 using content::BrowserThread; |
14 | 15 |
15 static const char* kURL1 = "http://www.google.com/"; | 16 static const char* kURL1 = "http://www.google.com/"; |
16 static const char* kURL2 = "http://www.gmail.com/"; | 17 static const char* kURL2 = "http://www.gmail.com/"; |
17 | 18 |
18 namespace chromeos { | 19 namespace chromeos { |
19 | 20 |
20 class OfflineLoadPageTest; | 21 class OfflineLoadPageTest; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 68 } |
68 | 69 |
69 void OnBlockingPageComplete(bool proceed) { | 70 void OnBlockingPageComplete(bool proceed) { |
70 if (proceed) | 71 if (proceed) |
71 user_response_ = OK; | 72 user_response_ = OK; |
72 else | 73 else |
73 user_response_ = CANCEL; | 74 user_response_ = CANCEL; |
74 } | 75 } |
75 | 76 |
76 void Navigate(const char* url, int page_id) { | 77 void Navigate(const char* url, int page_id) { |
77 contents()->TestDidNavigate( | 78 ViewHostMsg_FrameNavigate_Params params; |
78 contents()->render_view_host(), page_id, GURL(url), | 79 InitNavigateParams( |
79 content::PAGE_TRANSITION_TYPED); | 80 ¶ms, page_id, GURL(url), content::PAGE_TRANSITION_TYPED); |
| 81 contents()->TestDidNavigate(contents()->render_view_host(), params); |
80 } | 82 } |
81 | 83 |
82 void ShowInterstitial(const char* url) { | 84 void ShowInterstitial(const char* url) { |
83 (new TestOfflineLoadPage(contents(), GURL(url), this))->Show(); | 85 (new TestOfflineLoadPage(contents(), GURL(url), this))->Show(); |
84 } | 86 } |
85 | 87 |
86 // Returns the OfflineLoadPage currently showing or NULL if none is | 88 // Returns the OfflineLoadPage currently showing or NULL if none is |
87 // showing. | 89 // showing. |
88 InterstitialPage* GetOfflineLoadPage() { | 90 InterstitialPage* GetOfflineLoadPage() { |
89 return InterstitialPage::GetInterstitialPage(contents()); | 91 return InterstitialPage::GetInterstitialPage(contents()); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // The interstitial should be gone. | 156 // The interstitial should be gone. |
155 EXPECT_EQ(CANCEL, user_response()); | 157 EXPECT_EQ(CANCEL, user_response()); |
156 EXPECT_FALSE(GetOfflineLoadPage()); | 158 EXPECT_FALSE(GetOfflineLoadPage()); |
157 // We did not proceed, the pending entry should be gone. | 159 // We did not proceed, the pending entry should be gone. |
158 EXPECT_FALSE(controller().pending_entry()); | 160 EXPECT_FALSE(controller().pending_entry()); |
159 // the URL is set back to kURL1. | 161 // the URL is set back to kURL1. |
160 EXPECT_EQ(kURL1, contents()->GetURL().spec()); | 162 EXPECT_EQ(kURL1, contents()->GetURL().spec()); |
161 } | 163 } |
162 | 164 |
163 } // namespace chromeos | 165 } // namespace chromeos |
OLD | NEW |