| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/android/offline_pages/offline_page_tab_helper.h" | 5 #include "chrome/browser/android/offline_pages/offline_page_tab_helper.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | 14 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
| 15 #include "chrome/browser/android/offline_pages/test_offline_page_model_builder.h
" | 15 #include "chrome/browser/android/offline_pages/test_offline_page_model_builder.h
" |
| 16 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 16 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 17 #include "components/offline_pages/offline_page_feature.h" | 17 #include "components/offline_pages/offline_page_feature.h" |
| 18 #include "components/offline_pages/offline_page_item.h" | 18 #include "components/offline_pages/offline_page_item.h" |
| 19 #include "components/offline_pages/offline_page_model.h" | 19 #include "components/offline_pages/offline_page_model.h" |
| 20 #include "components/offline_pages/offline_page_test_archiver.h" | 20 #include "components/offline_pages/offline_page_test_archiver.h" |
| 21 #include "components/offline_pages/offline_page_types.h" |
| 21 #include "content/public/browser/navigation_entry.h" | 22 #include "content/public/browser/navigation_entry.h" |
| 22 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 23 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
| 24 #include "net/base/network_change_notifier.h" | 25 #include "net/base/network_change_notifier.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 27 |
| 27 using SavePageResult = offline_pages::OfflinePageModel::SavePageResult; | |
| 28 using SingleOfflinePageItemResult = | |
| 29 offline_pages::OfflinePageModel::SingleOfflinePageItemResult; | |
| 30 | |
| 31 namespace offline_pages { | 28 namespace offline_pages { |
| 32 | 29 |
| 33 namespace { | 30 namespace { |
| 34 | 31 |
| 35 const GURL kTestPageUrl("http://test.org/page1"); | 32 const GURL kTestPageUrl("http://test.org/page1"); |
| 36 const ClientId kTestClientId = ClientId(kBookmarkNamespace, "1234"); | 33 const ClientId kTestClientId = ClientId(kBookmarkNamespace, "1234"); |
| 37 const int64_t kTestFileSize = 876543LL; | 34 const int64_t kTestFileSize = 876543LL; |
| 38 | 35 |
| 39 class TestNetworkChangeNotifier : public net::NetworkChangeNotifier { | 36 class TestNetworkChangeNotifier : public net::NetworkChangeNotifier { |
| 40 public: | 37 public: |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 StartLoad(online_url()); | 213 StartLoad(online_url()); |
| 217 RunUntilIdle(); | 214 RunUntilIdle(); |
| 218 EXPECT_EQ(online_url(), controller().GetPendingEntry()->GetURL()); | 215 EXPECT_EQ(online_url(), controller().GetPendingEntry()->GetURL()); |
| 219 | 216 |
| 220 // Redirection will be done immediately on navigation end with error. | 217 // Redirection will be done immediately on navigation end with error. |
| 221 FailLoad(online_url()); | 218 FailLoad(online_url()); |
| 222 EXPECT_EQ(offline_url(), controller().GetPendingEntry()->GetURL()); | 219 EXPECT_EQ(offline_url(), controller().GetPendingEntry()->GetURL()); |
| 223 } | 220 } |
| 224 | 221 |
| 225 } // namespace offline_pages | 222 } // namespace offline_pages |
| OLD | NEW |