Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: chrome/browser/android/offline_pages/offline_page_tab_helper_unittest.cc

Issue 1904613005: [Offline pages] Removing bookmarks dependency from offline pages component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests compilation Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/command_line.h" 10 #include "base/command_line.h"
(...skipping 11 matching lines...) Expand all
22 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
23 #include "net/base/net_errors.h" 23 #include "net/base/net_errors.h"
24 #include "net/base/network_change_notifier.h" 24 #include "net/base/network_change_notifier.h"
25 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
26 26
27 namespace offline_pages { 27 namespace offline_pages {
28 28
29 namespace { 29 namespace {
30 30
31 const GURL kTestPageUrl("http://test.org/page1"); 31 const GURL kTestPageUrl("http://test.org/page1");
32 const ClientId kTestPageBookmarkId = ClientId(BOOKMARK_NAMESPACE, "1234"); 32 const ClientId kTestClientId = ClientId(kBookmarkNamespace, "1234");
33 const int64_t kTestFileSize = 876543LL; 33 const int64_t kTestFileSize = 876543LL;
34 34
35 class TestNetworkChangeNotifier : public net::NetworkChangeNotifier { 35 class TestNetworkChangeNotifier : public net::NetworkChangeNotifier {
36 public: 36 public:
37 TestNetworkChangeNotifier() : online_(true) {} 37 TestNetworkChangeNotifier() : online_(true) {}
38 38
39 net::NetworkChangeNotifier::ConnectionType GetCurrentConnectionType() 39 net::NetworkChangeNotifier::ConnectionType GetCurrentConnectionType()
40 const override { 40 const override {
41 return online_ ? net::NetworkChangeNotifier::CONNECTION_UNKNOWN 41 return online_ ? net::NetworkChangeNotifier::CONNECTION_UNKNOWN
42 : net::NetworkChangeNotifier::CONNECTION_NONE; 42 : net::NetworkChangeNotifier::CONNECTION_NONE;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 OfflinePageModelFactory::GetInstance()->SetTestingFactoryAndUse( 110 OfflinePageModelFactory::GetInstance()->SetTestingFactoryAndUse(
111 browser_context(), BuildTestOfflinePageModel); 111 browser_context(), BuildTestOfflinePageModel);
112 RunUntilIdle(); 112 RunUntilIdle();
113 113
114 // Saves an offline page. 114 // Saves an offline page.
115 OfflinePageModel* model = 115 OfflinePageModel* model =
116 OfflinePageModelFactory::GetForBrowserContext(browser_context()); 116 OfflinePageModelFactory::GetForBrowserContext(browser_context());
117 std::unique_ptr<OfflinePageTestArchiver> archiver(BuildArchiver( 117 std::unique_ptr<OfflinePageTestArchiver> archiver(BuildArchiver(
118 kTestPageUrl, base::FilePath(FILE_PATH_LITERAL("page1.mhtml")))); 118 kTestPageUrl, base::FilePath(FILE_PATH_LITERAL("page1.mhtml"))));
119 model->SavePage( 119 model->SavePage(
120 kTestPageUrl, kTestPageBookmarkId, std::move(archiver), 120 kTestPageUrl, kTestClientId, std::move(archiver),
121 base::Bind(&OfflinePageTabHelperTest::OnSavePageDone, AsWeakPtr())); 121 base::Bind(&OfflinePageTabHelperTest::OnSavePageDone, AsWeakPtr()));
122 RunUntilIdle(); 122 RunUntilIdle();
123 } 123 }
124 124
125 void OfflinePageTabHelperTest::TearDown() { 125 void OfflinePageTabHelperTest::TearDown() {
126 content::RenderViewHostTestHarness::TearDown(); 126 content::RenderViewHostTestHarness::TearDown();
127 } 127 }
128 128
129 void OfflinePageTabHelperTest::RunUntilIdle() { 129 void OfflinePageTabHelperTest::RunUntilIdle() {
130 base::RunLoop().RunUntilIdle(); 130 base::RunLoop().RunUntilIdle();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 GURL online_url = page->url; 200 GURL online_url = page->url;
201 201
202 StartLoad(online_url); 202 StartLoad(online_url);
203 EXPECT_EQ(online_url, controller().GetPendingEntry()->GetURL()); 203 EXPECT_EQ(online_url, controller().GetPendingEntry()->GetURL());
204 204
205 FailLoad(online_url); 205 FailLoad(online_url);
206 EXPECT_EQ(offline_url, controller().GetPendingEntry()->GetURL()); 206 EXPECT_EQ(offline_url, controller().GetPendingEntry()->GetURL());
207 } 207 }
208 208
209 } // namespace offline_pages 209 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698