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

Side by Side Diff: chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win_unittest.cc

Issue 2939973003: Download cleanup tool based on experiment config and OS bitness (Closed)
Patch Set: Test fixture's SetUp method should have override Created 3 years, 6 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win .h" 5 #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win .h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 base::FilePath response_path_; 88 base::FilePath response_path_;
89 89
90 // Variables set by FetchedCallback(). 90 // Variables set by FetchedCallback().
91 bool callback_called_ = false; 91 bool callback_called_ = false;
92 base::FilePath downloaded_path_; 92 base::FilePath downloaded_path_;
93 ChromeCleanerFetchStatus fetch_status_ = 93 ChromeCleanerFetchStatus fetch_status_ =
94 ChromeCleanerFetchStatus::kOtherFailure; 94 ChromeCleanerFetchStatus::kOtherFailure;
95 }; 95 };
96 96
97 TEST_F(ChromeCleanerFetcherTest, FetchSuccess) { 97 TEST_F(ChromeCleanerFetcherTest, FetchSuccess) {
98 EXPECT_EQ(GURL(fetcher_->GetOriginalURL()), GURL(GetSRTDownloadURL())); 98 EXPECT_EQ(GURL(fetcher_->GetOriginalURL()), GetSRTDownloadURL());
99 99
100 // Set up the fetcher to return success. 100 // Set up the fetcher to return success.
101 fetcher_->set_status(net::URLRequestStatus{}); 101 fetcher_->set_status(net::URLRequestStatus{});
102 fetcher_->set_response_code(net::HTTP_OK); 102 fetcher_->set_response_code(net::HTTP_OK);
103 103
104 fetcher_->delegate()->OnURLFetchComplete(fetcher_); 104 fetcher_->delegate()->OnURLFetchComplete(fetcher_);
105 105
106 EXPECT_TRUE(callback_called_); 106 EXPECT_TRUE(callback_called_);
107 EXPECT_EQ(downloaded_path_, response_path_); 107 EXPECT_EQ(downloaded_path_, response_path_);
108 EXPECT_EQ(fetch_status_, ChromeCleanerFetchStatus::kSuccess); 108 EXPECT_EQ(fetch_status_, ChromeCleanerFetchStatus::kSuccess);
(...skipping 20 matching lines...) Expand all
129 129
130 fetcher_->delegate()->OnURLFetchComplete(fetcher_); 130 fetcher_->delegate()->OnURLFetchComplete(fetcher_);
131 131
132 EXPECT_TRUE(callback_called_); 132 EXPECT_TRUE(callback_called_);
133 EXPECT_TRUE(downloaded_path_.empty()); 133 EXPECT_TRUE(downloaded_path_.empty());
134 EXPECT_EQ(fetch_status_, ChromeCleanerFetchStatus::kOtherFailure); 134 EXPECT_EQ(fetch_status_, ChromeCleanerFetchStatus::kOtherFailure);
135 } 135 }
136 136
137 } // namespace 137 } // namespace
138 } // namespace safe_browsing 138 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698