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

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

Issue 12967016: Improve <adview> implementation and add tests. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Code review feedback. Created 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/component_updater/component_updater_service.h" 5 #include "chrome/browser/component_updater/component_updater_service.h"
6 6
7 #include <list> 7 #include <list>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // are generated. 287 // are generated.
288 TEST_F(ComponentUpdaterTest, CheckCrxSleep) { 288 TEST_F(ComponentUpdaterTest, CheckCrxSleep) {
289 MessageLoop message_loop; 289 MessageLoop message_loop;
290 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); 290 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
291 content::TestBrowserThread file_thread(BrowserThread::FILE); 291 content::TestBrowserThread file_thread(BrowserThread::FILE);
292 content::TestBrowserThread io_thread(BrowserThread::IO); 292 content::TestBrowserThread io_thread(BrowserThread::IO);
293 293
294 io_thread.StartIOThread(); 294 io_thread.StartIOThread();
295 file_thread.Start(); 295 file_thread.Start();
296 296
297 content::URLRequestPrepackagedInterceptor interceptor; 297 content::URLLocalHostRequestPrepackagedInterceptor interceptor;
298 298
299 CrxComponent com; 299 CrxComponent com;
300 RegisterComponent(&com, kTestComponent_abag, Version("1.1")); 300 RegisterComponent(&com, kTestComponent_abag, Version("1.1"));
301 301
302 const GURL expected_update_url( 302 const GURL expected_update_url(
303 "http://localhost/upd?extra=foo&x=id%3D" 303 "http://localhost/upd?extra=foo&x=id%3D"
304 "abagagagagagagagagagagagagagagag%26v%3D1.1%26uc"); 304 "abagagagagagagagagagagagagagagag%26v%3D1.1%26uc");
305 305
306 interceptor.SetResponse(expected_update_url, 306 interceptor.SetResponse(expected_update_url,
307 test_file("updatecheck_reply_1.xml")); 307 test_file("updatecheck_reply_1.xml"));
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 // 3- second manifest check. 365 // 3- second manifest check.
366 TEST_F(ComponentUpdaterTest, InstallCrx) { 366 TEST_F(ComponentUpdaterTest, InstallCrx) {
367 MessageLoop message_loop; 367 MessageLoop message_loop;
368 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); 368 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
369 content::TestBrowserThread file_thread(BrowserThread::FILE); 369 content::TestBrowserThread file_thread(BrowserThread::FILE);
370 content::TestBrowserThread io_thread(BrowserThread::IO); 370 content::TestBrowserThread io_thread(BrowserThread::IO);
371 371
372 io_thread.StartIOThread(); 372 io_thread.StartIOThread();
373 file_thread.Start(); 373 file_thread.Start();
374 374
375 content::URLRequestPrepackagedInterceptor interceptor; 375 content::URLLocalHostRequestPrepackagedInterceptor interceptor;
376 376
377 CrxComponent com1; 377 CrxComponent com1;
378 RegisterComponent(&com1, kTestComponent_jebg, Version("0.9")); 378 RegisterComponent(&com1, kTestComponent_jebg, Version("0.9"));
379 CrxComponent com2; 379 CrxComponent com2;
380 RegisterComponent(&com2, kTestComponent_abag, Version("2.2")); 380 RegisterComponent(&com2, kTestComponent_abag, Version("2.2"));
381 381
382 const GURL expected_update_url_1( 382 const GURL expected_update_url_1(
383 "http://localhost/upd?extra=foo&x=id%3D" 383 "http://localhost/upd?extra=foo&x=id%3D"
384 "jebgalgnebhfojomionfpkfelancnnkf%26v%3D0.9%26uc&x=id%3D" 384 "jebgalgnebhfojomionfpkfelancnnkf%26v%3D0.9%26uc&x=id%3D"
385 "abagagagagagagagagagagagagagagag%26v%3D2.2%26uc"); 385 "abagagagagagagagagagagagagagagag%26v%3D2.2%26uc");
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 // checks to different urls, each only containing one component. 430 // checks to different urls, each only containing one component.
431 TEST_F(ComponentUpdaterTest, InstallCrxTwoSources) { 431 TEST_F(ComponentUpdaterTest, InstallCrxTwoSources) {
432 MessageLoop message_loop; 432 MessageLoop message_loop;
433 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); 433 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
434 content::TestBrowserThread file_thread(BrowserThread::FILE); 434 content::TestBrowserThread file_thread(BrowserThread::FILE);
435 content::TestBrowserThread io_thread(BrowserThread::IO); 435 content::TestBrowserThread io_thread(BrowserThread::IO);
436 436
437 io_thread.StartIOThread(); 437 io_thread.StartIOThread();
438 file_thread.Start(); 438 file_thread.Start();
439 439
440 content::URLRequestPrepackagedInterceptor interceptor; 440 content::URLLocalHostRequestPrepackagedInterceptor interceptor;
441 441
442 CrxComponent com1; 442 CrxComponent com1;
443 RegisterComponent(&com1, kTestComponent_abag, Version("2.2")); 443 RegisterComponent(&com1, kTestComponent_abag, Version("2.2"));
444 CrxComponent com2; 444 CrxComponent com2;
445 com2.source = CrxComponent::CWS_PUBLIC; 445 com2.source = CrxComponent::CWS_PUBLIC;
446 RegisterComponent(&com2, kTestComponent_jebg, Version("0.9")); 446 RegisterComponent(&com2, kTestComponent_jebg, Version("0.9"));
447 447
448 const GURL expected_update_url_1( 448 const GURL expected_update_url_1(
449 "http://localhost/upd?extra=foo&x=id%3D" 449 "http://localhost/upd?extra=foo&x=id%3D"
450 "abagagagagagagagagagagagagagagag%26v%3D2.2%26uc"); 450 "abagagagagagagagagagagagagagagag%26v%3D2.2%26uc");
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // version is much higher than of chrome. 502 // version is much higher than of chrome.
503 TEST_F(ComponentUpdaterTest, ProdVersionCheck) { 503 TEST_F(ComponentUpdaterTest, ProdVersionCheck) {
504 MessageLoop message_loop; 504 MessageLoop message_loop;
505 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); 505 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
506 content::TestBrowserThread file_thread(BrowserThread::FILE); 506 content::TestBrowserThread file_thread(BrowserThread::FILE);
507 content::TestBrowserThread io_thread(BrowserThread::IO); 507 content::TestBrowserThread io_thread(BrowserThread::IO);
508 508
509 io_thread.StartIOThread(); 509 io_thread.StartIOThread();
510 file_thread.Start(); 510 file_thread.Start();
511 511
512 content::URLRequestPrepackagedInterceptor interceptor; 512 content::URLLocalHostRequestPrepackagedInterceptor interceptor;
513 513
514 CrxComponent com; 514 CrxComponent com;
515 RegisterComponent(&com, kTestComponent_jebg, Version("0.9")); 515 RegisterComponent(&com, kTestComponent_jebg, Version("0.9"));
516 516
517 const GURL expected_update_url( 517 const GURL expected_update_url(
518 "http://localhost/upd?extra=foo&x=id%3D" 518 "http://localhost/upd?extra=foo&x=id%3D"
519 "jebgalgnebhfojomionfpkfelancnnkf%26v%3D0.9%26uc"); 519 "jebgalgnebhfojomionfpkfelancnnkf%26v%3D0.9%26uc");
520 520
521 interceptor.SetResponse(expected_update_url, 521 interceptor.SetResponse(expected_update_url,
522 test_file("updatecheck_reply_2.xml")); 522 test_file("updatecheck_reply_2.xml"));
(...skipping 19 matching lines...) Expand all
542 // - This triggers a second loop, which has a reply that triggers an install. 542 // - This triggers a second loop, which has a reply that triggers an install.
543 TEST_F(ComponentUpdaterTest, CheckForUpdateSoon) { 543 TEST_F(ComponentUpdaterTest, CheckForUpdateSoon) {
544 MessageLoop message_loop; 544 MessageLoop message_loop;
545 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); 545 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
546 content::TestBrowserThread file_thread(BrowserThread::FILE); 546 content::TestBrowserThread file_thread(BrowserThread::FILE);
547 content::TestBrowserThread io_thread(BrowserThread::IO); 547 content::TestBrowserThread io_thread(BrowserThread::IO);
548 548
549 io_thread.StartIOThread(); 549 io_thread.StartIOThread();
550 file_thread.Start(); 550 file_thread.Start();
551 551
552 content::URLRequestPrepackagedInterceptor interceptor; 552 content::URLLocalHostRequestPrepackagedInterceptor interceptor;
553 553
554 CrxComponent com1; 554 CrxComponent com1;
555 RegisterComponent(&com1, kTestComponent_abag, Version("2.2")); 555 RegisterComponent(&com1, kTestComponent_abag, Version("2.2"));
556 CrxComponent com2; 556 CrxComponent com2;
557 RegisterComponent(&com2, kTestComponent_jebg, Version("0.9")); 557 RegisterComponent(&com2, kTestComponent_jebg, Version("0.9"));
558 558
559 const GURL expected_update_url_1( 559 const GURL expected_update_url_1(
560 "http://localhost/upd?extra=foo&x=id%3D" 560 "http://localhost/upd?extra=foo&x=id%3D"
561 "abagagagagagagagagagagagagagagag%26v%3D2.2%26uc&x=id%3D" 561 "abagagagagagagagagagagagagagagag%26v%3D2.2%26uc&x=id%3D"
562 "jebgalgnebhfojomionfpkfelancnnkf%26v%3D0.9%26uc"); 562 "jebgalgnebhfojomionfpkfelancnnkf%26v%3D0.9%26uc");
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 646
647 message_loop.Run(); 647 message_loop.Run();
648 648
649 ASSERT_EQ(2ul, notification_tracker().size()); 649 ASSERT_EQ(2ul, notification_tracker().size());
650 ev0 = notification_tracker().at(0); 650 ev0 = notification_tracker().at(0);
651 EXPECT_EQ(chrome::NOTIFICATION_COMPONENT_UPDATER_STARTED, ev0.type); 651 EXPECT_EQ(chrome::NOTIFICATION_COMPONENT_UPDATER_STARTED, ev0.type);
652 ev1 = notification_tracker().at(1); 652 ev1 = notification_tracker().at(1);
653 EXPECT_EQ(chrome::NOTIFICATION_COMPONENT_UPDATER_SLEEPING, ev1.type); 653 EXPECT_EQ(chrome::NOTIFICATION_COMPONENT_UPDATER_SLEEPING, ev1.type);
654 component_updater()->Stop(); 654 component_updater()->Stop();
655 } 655 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/ad_view_browsertest.cc » ('j') | chrome/browser/extensions/ad_view_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698