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

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

Issue 2848703004: Switch SupportsUserData uses to use unique_ptr. (Closed)
Patch Set: rev Created 3 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_utils.h" 5 #include "chrome/browser/android/offline_pages/offline_page_utils.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/files/file.h" 12 #include "base/files/file.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/memory/ptr_util.h"
15 #include "base/run_loop.h" 16 #include "base/run_loop.h"
16 #include "base/strings/string16.h" 17 #include "base/strings/string16.h"
17 #include "base/test/scoped_feature_list.h" 18 #include "base/test/scoped_feature_list.h"
18 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
19 #include "base/time/time.h" 20 #include "base/time/time.h"
20 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" 21 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
21 #include "chrome/browser/android/offline_pages/offline_page_tab_helper.h" 22 #include "chrome/browser/android/offline_pages/offline_page_tab_helper.h"
22 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" 23 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h"
23 #include "chrome/browser/android/offline_pages/test_offline_page_model_builder.h " 24 #include "chrome/browser/android/offline_pages/test_offline_page_model_builder.h "
24 #include "chrome/browser/android/offline_pages/test_request_coordinator_builder. h" 25 #include "chrome/browser/android/offline_pages/test_request_coordinator_builder. h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Create a test web contents. 127 // Create a test web contents.
127 web_contents_.reset(content::WebContents::Create( 128 web_contents_.reset(content::WebContents::Create(
128 content::WebContents::CreateParams(profile()))); 129 content::WebContents::CreateParams(profile())));
129 OfflinePageTabHelper::CreateForWebContents(web_contents_.get()); 130 OfflinePageTabHelper::CreateForWebContents(web_contents_.get());
130 131
131 // Set up the factory for testing. 132 // Set up the factory for testing.
132 OfflinePageModelFactory::GetInstance()->SetTestingFactoryAndUse( 133 OfflinePageModelFactory::GetInstance()->SetTestingFactoryAndUse(
133 &profile_, BuildTestOfflinePageModel); 134 &profile_, BuildTestOfflinePageModel);
134 RunUntilIdle(); 135 RunUntilIdle();
135 136
136 NetworkQualityProviderStub::SetUserData(&profile_, 137 NetworkQualityProviderStub::SetUserData(
137 new NetworkQualityProviderStub()); 138 &profile_, base::MakeUnique<NetworkQualityProviderStub>());
138 RequestCoordinatorFactory::GetInstance()->SetTestingFactoryAndUse( 139 RequestCoordinatorFactory::GetInstance()->SetTestingFactoryAndUse(
139 &profile_, BuildTestRequestCoordinator); 140 &profile_, BuildTestRequestCoordinator);
140 RunUntilIdle(); 141 RunUntilIdle();
141 142
142 // Make sure to create offline pages and requests. 143 // Make sure to create offline pages and requests.
143 CreateOfflinePages(); 144 CreateOfflinePages();
144 CreateRequests(); 145 CreateRequests();
145 } 146 }
146 147
147 void OfflinePageUtilsTest::RunUntilIdle() { 148 void OfflinePageUtilsTest::RunUntilIdle() {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 GURL("http://example.com/"), GURL("http://example.com/#test"))); 304 GURL("http://example.com/"), GURL("http://example.com/#test")));
304 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment( 305 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment(
305 GURL("http://example.com/#test"), GURL("http://example.com/"))); 306 GURL("http://example.com/#test"), GURL("http://example.com/")));
306 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment( 307 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment(
307 GURL("http://example.com/#test"), GURL("http://example.com/#test2"))); 308 GURL("http://example.com/#test"), GURL("http://example.com/#test2")));
308 EXPECT_FALSE(OfflinePageUtils::EqualsIgnoringFragment( 309 EXPECT_FALSE(OfflinePageUtils::EqualsIgnoringFragment(
309 GURL("http://example.com/"), GURL("http://test.com/#test"))); 310 GURL("http://example.com/"), GURL("http://test.com/#test")));
310 } 311 }
311 312
312 } // namespace offline_pages 313 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698