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