| OLD | NEW |
| 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 <limits> | 5 #include <limits> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 using update_client::abag_hash; | 229 using update_client::abag_hash; |
| 230 | 230 |
| 231 const std::string id1 = "abagagagagagagagagagagagagagagag"; | 231 const std::string id1 = "abagagagagagagagagagagagagagagag"; |
| 232 const std::string id2 = "jebgalgnebhfojomionfpkfelancnnkf"; | 232 const std::string id2 = "jebgalgnebhfojomionfpkfelancnnkf"; |
| 233 std::vector<std::string> ids; | 233 std::vector<std::string> ids; |
| 234 ids.push_back(id1); | 234 ids.push_back(id1); |
| 235 ids.push_back(id2); | 235 ids.push_back(id2); |
| 236 | 236 |
| 237 CrxComponent crx_component1; | 237 CrxComponent crx_component1; |
| 238 crx_component1.pk_hash.assign(abag_hash, abag_hash + arraysize(abag_hash)); | 238 crx_component1.pk_hash.assign(abag_hash, abag_hash + arraysize(abag_hash)); |
| 239 crx_component1.version = base::Version("1.0"); | 239 crx_component1.version = Version("1.0"); |
| 240 crx_component1.installer = installer; | 240 crx_component1.installer = installer; |
| 241 | 241 |
| 242 CrxComponent crx_component2; | 242 CrxComponent crx_component2; |
| 243 crx_component2.pk_hash.assign(jebg_hash, jebg_hash + arraysize(jebg_hash)); | 243 crx_component2.pk_hash.assign(jebg_hash, jebg_hash + arraysize(jebg_hash)); |
| 244 crx_component2.version = base::Version("0.9"); | 244 crx_component2.version = Version("0.9"); |
| 245 crx_component2.installer = installer; | 245 crx_component2.installer = installer; |
| 246 | 246 |
| 247 // Quit after two update checks have fired. | 247 // Quit after two update checks have fired. |
| 248 LoopHandler loop_handler(2, quit_closure()); | 248 LoopHandler loop_handler(2, quit_closure()); |
| 249 EXPECT_CALL(update_client(), Update(ids, _, _)) | 249 EXPECT_CALL(update_client(), Update(ids, _, _)) |
| 250 .WillRepeatedly(Invoke(&loop_handler, &LoopHandler::OnUpdate)); | 250 .WillRepeatedly(Invoke(&loop_handler, &LoopHandler::OnUpdate)); |
| 251 | 251 |
| 252 EXPECT_CALL(update_client(), IsUpdating(id1)).Times(1); | 252 EXPECT_CALL(update_client(), IsUpdating(id1)).Times(1); |
| 253 | 253 |
| 254 EXPECT_TRUE(component_updater().RegisterComponent(crx_component1)); | 254 EXPECT_TRUE(component_updater().RegisterComponent(crx_component1)); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 auto& cus = component_updater(); | 287 auto& cus = component_updater(); |
| 288 | 288 |
| 289 const std::string id = "jebgalgnebhfojomionfpkfelancnnkf"; | 289 const std::string id = "jebgalgnebhfojomionfpkfelancnnkf"; |
| 290 EXPECT_FALSE(OnDemandTester::OnDemand(&cus, id)); | 290 EXPECT_FALSE(OnDemandTester::OnDemand(&cus, id)); |
| 291 | 291 |
| 292 scoped_refptr<MockInstaller> installer(new MockInstaller()); | 292 scoped_refptr<MockInstaller> installer(new MockInstaller()); |
| 293 | 293 |
| 294 using update_client::jebg_hash; | 294 using update_client::jebg_hash; |
| 295 CrxComponent crx_component; | 295 CrxComponent crx_component; |
| 296 crx_component.pk_hash.assign(jebg_hash, jebg_hash + arraysize(jebg_hash)); | 296 crx_component.pk_hash.assign(jebg_hash, jebg_hash + arraysize(jebg_hash)); |
| 297 crx_component.version = base::Version("0.9"); | 297 crx_component.version = Version("0.9"); |
| 298 crx_component.installer = installer; | 298 crx_component.installer = installer; |
| 299 | 299 |
| 300 LoopHandler loop_handler(1, quit_closure()); | 300 LoopHandler loop_handler(1, quit_closure()); |
| 301 EXPECT_CALL(update_client(), | 301 EXPECT_CALL(update_client(), |
| 302 Install("jebgalgnebhfojomionfpkfelancnnkf", _, _)) | 302 Install("jebgalgnebhfojomionfpkfelancnnkf", _, _)) |
| 303 .WillOnce(Invoke(&loop_handler, &LoopHandler::OnInstall)); | 303 .WillOnce(Invoke(&loop_handler, &LoopHandler::OnInstall)); |
| 304 | 304 |
| 305 EXPECT_TRUE(cus.RegisterComponent(crx_component)); | 305 EXPECT_TRUE(cus.RegisterComponent(crx_component)); |
| 306 EXPECT_TRUE(OnDemandTester::OnDemand(&cus, id)); | 306 EXPECT_TRUE(OnDemandTester::OnDemand(&cus, id)); |
| 307 | 307 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 331 }; | 331 }; |
| 332 | 332 |
| 333 auto config = configurator(); | 333 auto config = configurator(); |
| 334 config->SetInitialDelay(3600); | 334 config->SetInitialDelay(3600); |
| 335 | 335 |
| 336 scoped_refptr<MockInstaller> installer(new MockInstaller()); | 336 scoped_refptr<MockInstaller> installer(new MockInstaller()); |
| 337 | 337 |
| 338 using update_client::jebg_hash; | 338 using update_client::jebg_hash; |
| 339 CrxComponent crx_component; | 339 CrxComponent crx_component; |
| 340 crx_component.pk_hash.assign(jebg_hash, jebg_hash + arraysize(jebg_hash)); | 340 crx_component.pk_hash.assign(jebg_hash, jebg_hash + arraysize(jebg_hash)); |
| 341 crx_component.version = base::Version("0.9"); | 341 crx_component.version = Version("0.9"); |
| 342 crx_component.installer = installer; | 342 crx_component.installer = installer; |
| 343 | 343 |
| 344 LoopHandler loop_handler(1, quit_closure()); | 344 LoopHandler loop_handler(1, quit_closure()); |
| 345 EXPECT_CALL(update_client(), | 345 EXPECT_CALL(update_client(), |
| 346 Install("jebgalgnebhfojomionfpkfelancnnkf", _, _)) | 346 Install("jebgalgnebhfojomionfpkfelancnnkf", _, _)) |
| 347 .WillOnce(Invoke(&loop_handler, &LoopHandler::OnInstall)); | 347 .WillOnce(Invoke(&loop_handler, &LoopHandler::OnInstall)); |
| 348 | 348 |
| 349 EXPECT_TRUE(component_updater().RegisterComponent(crx_component)); | 349 EXPECT_TRUE(component_updater().RegisterComponent(crx_component)); |
| 350 component_updater().MaybeThrottle( | 350 component_updater().MaybeThrottle( |
| 351 "jebgalgnebhfojomionfpkfelancnnkf", | 351 "jebgalgnebhfojomionfpkfelancnnkf", |
| 352 base::Bind(&ComponentUpdaterTest::ReadyCallback)); | 352 base::Bind(&ComponentUpdaterTest::ReadyCallback)); |
| 353 | 353 |
| 354 RunThreads(); | 354 RunThreads(); |
| 355 } | 355 } |
| 356 | 356 |
| 357 } // namespace component_updater | 357 } // namespace component_updater |
| OLD | NEW |