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

Side by Side Diff: chrome/browser/services/gcm/gcm_service_unittest.cc

Issue 251093002: Disable subset of GCMServiceTest.* on Android. Flaky. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit space Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/services/gcm/gcm_service.h" 5 #include "chrome/browser/services/gcm/gcm_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 460 }
461 461
462 TEST_F(GCMServiceTest, Shutdown) { 462 TEST_F(GCMServiceTest, Shutdown) {
463 wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING); 463 wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING);
464 EXPECT_TRUE(wrapper_->ServiceHasAppHandlers()); 464 EXPECT_TRUE(wrapper_->ServiceHasAppHandlers());
465 465
466 wrapper_->service()->ShutdownService(); 466 wrapper_->service()->ShutdownService();
467 EXPECT_FALSE(wrapper_->ServiceHasAppHandlers()); 467 EXPECT_FALSE(wrapper_->ServiceHasAppHandlers());
468 } 468 }
469 469
470 TEST_F(GCMServiceTest, SignInAndSignOutUnderPositiveChannelSignal) { 470 // These tests are flaky on Android. See http://crbug.com/367600.
471 #if defined(OS_ANDROID)
472 #define MAYBE_SignInAndSignOutUnderPositiveChannelSignal \
473 DISABLED_SignInAndSignOutUnderPositiveChannelSignal
474 #define MAYBE_SignInAndSignOutUnderNonPositiveChannelSignal \
475 DISABLED_SignInAndSignOutUnderNonPositiveChannelSignal
476 #define MAYBE_SignOutAndThenSignIn \
477 DISABLED_SignOutAndThenSignIn
478 #define MAYBE_StopAndRestartGCM \
479 DISABLED_StopAndRestartGCM
480 #else
481 #define MAYBE_SignInAndSignOutUnderPositiveChannelSignal \
482 SignInAndSignOutUnderPositiveChannelSignal
483 #define MAYBE_SignInAndSignOutUnderNonPositiveChannelSignal \
484 SignInAndSignOutUnderNonPositiveChannelSignal
485 #define MAYBE_SignOutAndThenSignIn \
486 SignOutAndThenSignIn
487 #define MAYBE_StopAndRestartGCM \
488 StopAndRestartGCM
489 #endif
490
491 TEST_F(GCMServiceTest, MAYBE_SignInAndSignOutUnderPositiveChannelSignal) {
471 wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING); 492 wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING);
472 wrapper_->SignIn(kTestAccountID1); 493 wrapper_->SignIn(kTestAccountID1);
473 494
474 // GCMClient should be loaded. 495 // GCMClient should be loaded.
475 EXPECT_TRUE(wrapper_->service()->IsGCMClientReady()); 496 EXPECT_TRUE(wrapper_->service()->IsGCMClientReady());
476 EXPECT_EQ(GCMClientMock::LOADED, wrapper_->GetGCMClient()->status()); 497 EXPECT_EQ(GCMClientMock::LOADED, wrapper_->GetGCMClient()->status());
477 498
478 wrapper_->SignOut(); 499 wrapper_->SignOut();
479 500
480 // GCMClient should be checked out. 501 // GCMClient should be checked out.
481 EXPECT_FALSE(wrapper_->service()->IsGCMClientReady()); 502 EXPECT_FALSE(wrapper_->service()->IsGCMClientReady());
482 EXPECT_EQ(GCMClientMock::CHECKED_OUT, wrapper_->GetGCMClient()->status()); 503 EXPECT_EQ(GCMClientMock::CHECKED_OUT, wrapper_->GetGCMClient()->status());
483 } 504 }
484 505
485 TEST_F(GCMServiceTest, SignInAndSignOutUnderNonPositiveChannelSignal) { 506 TEST_F(GCMServiceTest, MAYBE_SignInAndSignOutUnderNonPositiveChannelSignal) {
486 // Non-positive channel signal will prevent GCMClient from checking in during 507 // Non-positive channel signal will prevent GCMClient from checking in during
487 // sign-in. 508 // sign-in.
488 wrapper_->CreateService(false, GCMClientMock::NO_DELAY_LOADING); 509 wrapper_->CreateService(false, GCMClientMock::NO_DELAY_LOADING);
489 wrapper_->SignIn(kTestAccountID1); 510 wrapper_->SignIn(kTestAccountID1);
490 511
491 // GCMClient should not be loaded. 512 // GCMClient should not be loaded.
492 EXPECT_FALSE(wrapper_->service()->IsGCMClientReady()); 513 EXPECT_FALSE(wrapper_->service()->IsGCMClientReady());
493 EXPECT_EQ(GCMClientMock::UNINITIALIZED, wrapper_->GetGCMClient()->status()); 514 EXPECT_EQ(GCMClientMock::UNINITIALIZED, wrapper_->GetGCMClient()->status());
494 515
495 wrapper_->SignOut(); 516 wrapper_->SignOut();
496 517
497 // Check-out should still be performed. 518 // Check-out should still be performed.
498 EXPECT_FALSE(wrapper_->service()->IsGCMClientReady()); 519 EXPECT_FALSE(wrapper_->service()->IsGCMClientReady());
499 EXPECT_EQ(GCMClientMock::CHECKED_OUT, wrapper_->GetGCMClient()->status()); 520 EXPECT_EQ(GCMClientMock::CHECKED_OUT, wrapper_->GetGCMClient()->status());
500 } 521 }
501 522
502 TEST_F(GCMServiceTest, SignOutAndThenSignIn) { 523 TEST_F(GCMServiceTest, MAYBE_SignOutAndThenSignIn) {
503 wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING); 524 wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING);
504 wrapper_->SignIn(kTestAccountID1); 525 wrapper_->SignIn(kTestAccountID1);
505 526
506 // GCMClient should be loaded. 527 // GCMClient should be loaded.
507 EXPECT_TRUE(wrapper_->service()->IsGCMClientReady()); 528 EXPECT_TRUE(wrapper_->service()->IsGCMClientReady());
508 EXPECT_EQ(GCMClientMock::LOADED, wrapper_->GetGCMClient()->status()); 529 EXPECT_EQ(GCMClientMock::LOADED, wrapper_->GetGCMClient()->status());
509 530
510 wrapper_->SignOut(); 531 wrapper_->SignOut();
511 532
512 // GCMClient should be checked out. 533 // GCMClient should be checked out.
513 EXPECT_FALSE(wrapper_->service()->IsGCMClientReady()); 534 EXPECT_FALSE(wrapper_->service()->IsGCMClientReady());
514 EXPECT_EQ(GCMClientMock::CHECKED_OUT, wrapper_->GetGCMClient()->status()); 535 EXPECT_EQ(GCMClientMock::CHECKED_OUT, wrapper_->GetGCMClient()->status());
515 536
516 // Sign-in with a different account. 537 // Sign-in with a different account.
517 wrapper_->SignIn(kTestAccountID2); 538 wrapper_->SignIn(kTestAccountID2);
518 539
519 // GCMClient should be loaded again. 540 // GCMClient should be loaded again.
520 EXPECT_TRUE(wrapper_->service()->IsGCMClientReady()); 541 EXPECT_TRUE(wrapper_->service()->IsGCMClientReady());
521 EXPECT_EQ(GCMClientMock::LOADED, wrapper_->GetGCMClient()->status()); 542 EXPECT_EQ(GCMClientMock::LOADED, wrapper_->GetGCMClient()->status());
522 } 543 }
523 544
524 TEST_F(GCMServiceTest, StopAndRestartGCM) { 545 TEST_F(GCMServiceTest, MAYBE_StopAndRestartGCM) {
525 wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING); 546 wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING);
526 wrapper_->SignIn(kTestAccountID1); 547 wrapper_->SignIn(kTestAccountID1);
527 548
528 // GCMClient should be loaded. 549 // GCMClient should be loaded.
529 EXPECT_TRUE(wrapper_->service()->IsGCMClientReady()); 550 EXPECT_TRUE(wrapper_->service()->IsGCMClientReady());
530 EXPECT_EQ(GCMClientMock::LOADED, wrapper_->GetGCMClient()->status()); 551 EXPECT_EQ(GCMClientMock::LOADED, wrapper_->GetGCMClient()->status());
531 552
532 // Stops the GCM. 553 // Stops the GCM.
533 wrapper_->service()->Stop(); 554 wrapper_->service()->Stop();
534 PumpIOLoop(); 555 PumpIOLoop();
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 wrapper_->GetGCMClient()->ReceiveMessage(kTestAppID1, in_message5); 1330 wrapper_->GetGCMClient()->ReceiveMessage(kTestAppID1, in_message5);
1310 1331
1311 wrapper_->gcm_app_handler()->WaitForNotification(); 1332 wrapper_->gcm_app_handler()->WaitForNotification();
1312 1333
1313 EXPECT_EQ(FakeGCMAppHandler::MESSAGE_EVENT, 1334 EXPECT_EQ(FakeGCMAppHandler::MESSAGE_EVENT,
1314 wrapper_->gcm_app_handler()->received_event()); 1335 wrapper_->gcm_app_handler()->received_event());
1315 EXPECT_EQ(in_message5.data, wrapper_->gcm_app_handler()->message().data); 1336 EXPECT_EQ(in_message5.data, wrapper_->gcm_app_handler()->message().data);
1316 } 1337 }
1317 1338
1318 } // namespace gcm 1339 } // namespace gcm
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698