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

Side by Side Diff: chrome/browser/chromeos/display/quirks_browsertest.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/memory/ptr_util.h"
7 #include "base/run_loop.h" 8 #include "base/run_loop.h"
8 #include "chrome/test/base/in_process_browser_test.h" 9 #include "chrome/test/base/in_process_browser_test.h"
9 #include "components/quirks/quirks_manager.h" 10 #include "components/quirks/quirks_manager.h"
10 #include "components/quirks/switches.h" 11 #include "components/quirks/switches.h"
11 #include "content/public/test/test_utils.h" 12 #include "content/public/test/test_utils.h"
12 #include "net/url_request/test_url_fetcher_factory.h" 13 #include "net/url_request/test_url_fetcher_factory.h"
13 14
14 namespace quirks { 15 namespace quirks {
15 16
16 namespace { 17 namespace {
17 18
18 const char kFakeIccJson[] = "{\n \"icc\": \"AAAIkCAgICACEAAA\"\n}"; 19 const char kFakeIccJson[] = "{\n \"icc\": \"AAAIkCAgICACEAAA\"\n}";
19 const char kFakeIccData[] = {0x00, 0x00, 0x08, 0x90, 0x20, 0x20, 20 const char kFakeIccData[] = {0x00, 0x00, 0x08, 0x90, 0x20, 0x20,
20 0x20, 0x20, 0x02, 0x10, 0x00, 0x00}; 21 0x20, 0x20, 0x02, 0x10, 0x00, 0x00};
21 22
22 // Create FakeURLFetcher which returns fake icc file json. 23 // Create FakeURLFetcher which returns fake icc file json.
23 scoped_ptr<net::URLFetcher> CreateFakeURLFetcherSuccess( 24 std::unique_ptr<net::URLFetcher> CreateFakeURLFetcherSuccess(
24 const GURL& url, 25 const GURL& url,
25 net::URLFetcherDelegate* delegate) { 26 net::URLFetcherDelegate* delegate) {
26 net::URLFetcher* fetcher = 27 net::URLFetcher* fetcher =
27 new net::FakeURLFetcher(url, delegate, kFakeIccJson, net::HTTP_OK, 28 new net::FakeURLFetcher(url, delegate, kFakeIccJson, net::HTTP_OK,
28 net::URLRequestStatus::SUCCESS); 29 net::URLRequestStatus::SUCCESS);
29 return make_scoped_ptr(fetcher); 30 return base::WrapUnique(fetcher);
30 } 31 }
31 32
32 // Create FakeURLFetcher which replies with HTTP_NOT_FOUND. 33 // Create FakeURLFetcher which replies with HTTP_NOT_FOUND.
33 scoped_ptr<net::URLFetcher> CreateFakeURLFetcherFailure( 34 std::unique_ptr<net::URLFetcher> CreateFakeURLFetcherFailure(
34 const GURL& url, 35 const GURL& url,
35 net::URLFetcherDelegate* delegate) { 36 net::URLFetcherDelegate* delegate) {
36 net::URLFetcher* fetcher = new net::FakeURLFetcher( 37 net::URLFetcher* fetcher = new net::FakeURLFetcher(
37 url, delegate, "File not found", net::HTTP_NOT_FOUND, 38 url, delegate, "File not found", net::HTTP_NOT_FOUND,
38 net::URLRequestStatus::FAILED); 39 net::URLRequestStatus::FAILED);
39 return make_scoped_ptr(fetcher); 40 return base::WrapUnique(fetcher);
40 } 41 }
41 42
42 // Full path to fake icc file in <tmp test directory>/display_profiles/. 43 // Full path to fake icc file in <tmp test directory>/display_profiles/.
43 base::FilePath GetPathForIccFile(int64_t product_id) { 44 base::FilePath GetPathForIccFile(int64_t product_id) {
44 return QuirksManager::Get() 45 return QuirksManager::Get()
45 ->delegate() 46 ->delegate()
46 ->GetDownloadDisplayProfileDirectory() 47 ->GetDownloadDisplayProfileDirectory()
47 .Append(quirks::IdToFileName(product_id)); 48 .Append(quirks::IdToFileName(product_id));
48 } 49 }
49 50
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 EXPECT_EQ(file_existed_, true); 129 EXPECT_EQ(file_existed_, true);
129 130
130 // Finally, request a file that doesn't exist on fake Quirks Server. 131 // Finally, request a file that doesn't exist on fake Quirks Server.
131 TestQuirksClient(0x1111bbbb, false); 132 TestQuirksClient(0x1111bbbb, false);
132 EXPECT_EQ(icc_path_, base::FilePath()); 133 EXPECT_EQ(icc_path_, base::FilePath());
133 EXPECT_EQ(file_existed_, false); 134 EXPECT_EQ(file_existed_, false);
134 EXPECT_FALSE(base::PathExists(GetPathForIccFile(0x1111bbbb))); 135 EXPECT_FALSE(base::PathExists(GetPathForIccFile(0x1111bbbb)));
135 } 136 }
136 137
137 } // namespace quirks 138 } // namespace quirks
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/display/overscan_calibrator.h ('k') | chrome/browser/chromeos/drive/debug_info_collector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698