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

Side by Side Diff: chrome/browser/component_updater/test/update_checker_unittest.cc

Issue 334783002: Componentize component_updater: Move some paths/constants to component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge origin/master Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/version.h" 12 #include "base/version.h"
13 #include "chrome/browser/component_updater/crx_update_item.h" 13 #include "chrome/browser/component_updater/crx_update_item.h"
14 #include "chrome/browser/component_updater/test/component_updater_service_unitte st.h" 14 #include "chrome/browser/component_updater/test/component_updater_service_unitte st.h"
15 #include "chrome/browser/component_updater/test/url_request_post_interceptor.h" 15 #include "chrome/browser/component_updater/test/url_request_post_interceptor.h"
16 #include "chrome/browser/component_updater/update_checker.h" 16 #include "chrome/browser/component_updater/update_checker.h"
17 #include "chrome/common/chrome_paths.h" 17 #include "chrome/common/chrome_paths.h"
18 #include "chrome/common/chrome_version_info.h"
18 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
19 #include "content/public/test/test_browser_thread_bundle.h" 20 #include "content/public/test/test_browser_thread_bundle.h"
20 #include "net/url_request/url_fetcher.h" 21 #include "net/url_request/url_fetcher.h"
21 #include "net/url_request/url_request_test_util.h" 22 #include "net/url_request/url_request_test_util.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 24
24 using content::BrowserThread; 25 using content::BrowserThread;
25 26
26 namespace component_updater { 27 namespace component_updater {
27 28
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 update_checker_ = 166 update_checker_ =
166 UpdateChecker::Create(GURL("https://localhost2/update2"), 167 UpdateChecker::Create(GURL("https://localhost2/update2"),
167 context(), 168 context(),
168 base::Bind(&UpdateCheckerTest::UpdateCheckComplete, 169 base::Bind(&UpdateCheckerTest::UpdateCheckComplete,
169 base::Unretained(this))).Pass(); 170 base::Unretained(this))).Pass();
170 171
171 CrxUpdateItem item(BuildCrxUpdateItem()); 172 CrxUpdateItem item(BuildCrxUpdateItem());
172 std::vector<CrxUpdateItem*> items_to_check; 173 std::vector<CrxUpdateItem*> items_to_check;
173 items_to_check.push_back(&item); 174 items_to_check.push_back(&item);
174 175
175 update_checker_->CheckForUpdates(items_to_check, "extra=\"params\""); 176 update_checker_->CheckForUpdates(chrome::VersionInfo().Version(),
177 chrome::VersionInfo().OSType(),
178 items_to_check,
179 "extra=\"params\"");
176 180
177 RunThreads(); 181 RunThreads();
178 182
179 EXPECT_EQ(1, post_interceptor_->GetHitCount()) 183 EXPECT_EQ(1, post_interceptor_->GetHitCount())
180 << post_interceptor_->GetRequestsAsString(); 184 << post_interceptor_->GetRequestsAsString();
181 EXPECT_EQ(1, post_interceptor_->GetCount()) 185 EXPECT_EQ(1, post_interceptor_->GetCount())
182 << post_interceptor_->GetRequestsAsString(); 186 << post_interceptor_->GetRequestsAsString();
183 187
184 // Sanity check the request. 188 // Sanity check the request.
185 EXPECT_NE( 189 EXPECT_NE(
(...skipping 29 matching lines...) Expand all
215 update_checker_ = 219 update_checker_ =
216 UpdateChecker::Create(GURL("https://localhost2/update2"), 220 UpdateChecker::Create(GURL("https://localhost2/update2"),
217 context(), 221 context(),
218 base::Bind(&UpdateCheckerTest::UpdateCheckComplete, 222 base::Bind(&UpdateCheckerTest::UpdateCheckComplete,
219 base::Unretained(this))).Pass(); 223 base::Unretained(this))).Pass();
220 224
221 CrxUpdateItem item(BuildCrxUpdateItem()); 225 CrxUpdateItem item(BuildCrxUpdateItem());
222 std::vector<CrxUpdateItem*> items_to_check; 226 std::vector<CrxUpdateItem*> items_to_check;
223 items_to_check.push_back(&item); 227 items_to_check.push_back(&item);
224 228
225 update_checker_->CheckForUpdates(items_to_check, ""); 229 update_checker_->CheckForUpdates(chrome::VersionInfo().Version(),
230 chrome::VersionInfo().OSType(),
231 items_to_check,
232 "");
226 233
227 RunThreads(); 234 RunThreads();
228 235
229 EXPECT_EQ(0, post_interceptor_->GetHitCount()) 236 EXPECT_EQ(0, post_interceptor_->GetHitCount())
230 << post_interceptor_->GetRequestsAsString(); 237 << post_interceptor_->GetRequestsAsString();
231 EXPECT_EQ(1, post_interceptor_->GetCount()) 238 EXPECT_EQ(1, post_interceptor_->GetCount())
232 << post_interceptor_->GetRequestsAsString(); 239 << post_interceptor_->GetRequestsAsString();
233 240
234 EXPECT_NE(0, error_); 241 EXPECT_NE(0, error_);
235 EXPECT_STREQ("network error", error_message_.c_str()); 242 EXPECT_STREQ("network error", error_message_.c_str());
236 EXPECT_EQ(0ul, results_.list.size()); 243 EXPECT_EQ(0ul, results_.list.size());
237 } 244 }
238 245
239 } // namespace component_updater 246 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698