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

Side by Side Diff: chrome/browser/extensions/api/idle/idle_api_unittest.cc

Issue 16295003: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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 (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/extensions/api/idle/idle_api.h" 5 #include "chrome/browser/extensions/api/idle/idle_api.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <string> 8 #include <string>
9 9
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 { 515 {
516 ScopedListen listen(idle_manager_, extension_->id()); 516 ScopedListen listen(idle_manager_, extension_->id());
517 idle_provider_->set_idle_time(16); 517 idle_provider_->set_idle_time(16);
518 EXPECT_CALL(*event_delegate_, 518 EXPECT_CALL(*event_delegate_,
519 OnStateChanged(extension_->id(), IDLE_STATE_IDLE)); 519 OnStateChanged(extension_->id(), IDLE_STATE_IDLE));
520 idle_manager_->UpdateIdleState(); 520 idle_manager_->UpdateIdleState();
521 testing::Mock::VerifyAndClearExpectations(event_delegate_); 521 testing::Mock::VerifyAndClearExpectations(event_delegate_);
522 } 522 }
523 523
524 // Threshold will reset after unload (and listen count == 0) 524 // Threshold will reset after unload (and listen count == 0)
525 UnloadedExtensionInfo details(extension_, 525 UnloadedExtensionInfo details(extension_.get(),
526 extension_misc::UNLOAD_REASON_UNINSTALL); 526 extension_misc::UNLOAD_REASON_UNINSTALL);
527 idle_manager_->Observe( 527 idle_manager_->Observe(
528 chrome::NOTIFICATION_EXTENSION_UNLOADED, 528 chrome::NOTIFICATION_EXTENSION_UNLOADED,
529 content::Source<Profile>(browser()->profile()), 529 content::Source<Profile>(browser()->profile()),
530 content::Details<UnloadedExtensionInfo>(&details)); 530 content::Details<UnloadedExtensionInfo>(&details));
531 531
532 { 532 {
533 ScopedListen listen(idle_manager_, extension_->id()); 533 ScopedListen listen(idle_manager_, extension_->id());
534 idle_manager_->UpdateIdleState(); 534 idle_manager_->UpdateIdleState();
535 testing::Mock::VerifyAndClearExpectations(event_delegate_); 535 testing::Mock::VerifyAndClearExpectations(event_delegate_);
536 536
537 idle_provider_->set_idle_time(61); 537 idle_provider_->set_idle_time(61);
538 EXPECT_CALL(*event_delegate_, 538 EXPECT_CALL(*event_delegate_,
539 OnStateChanged(extension_->id(), IDLE_STATE_IDLE)); 539 OnStateChanged(extension_->id(), IDLE_STATE_IDLE));
540 idle_manager_->UpdateIdleState(); 540 idle_manager_->UpdateIdleState();
541 } 541 }
542 } 542 }
543 543
544 // Verifies that unloading an extension with no listeners or threshold works. 544 // Verifies that unloading an extension with no listeners or threshold works.
545 TEST_F(IdleTest, UnloadOnly) { 545 TEST_F(IdleTest, UnloadOnly) {
546 UnloadedExtensionInfo details(extension_, 546 UnloadedExtensionInfo details(extension_.get(),
547 extension_misc::UNLOAD_REASON_UNINSTALL); 547 extension_misc::UNLOAD_REASON_UNINSTALL);
548 idle_manager_->Observe( 548 idle_manager_->Observe(
549 chrome::NOTIFICATION_EXTENSION_UNLOADED, 549 chrome::NOTIFICATION_EXTENSION_UNLOADED,
550 content::Source<Profile>(browser()->profile()), 550 content::Source<Profile>(browser()->profile()),
551 content::Details<UnloadedExtensionInfo>(&details)); 551 content::Details<UnloadedExtensionInfo>(&details));
552 } 552 }
553 553
554 // Verifies that its ok for the unload notification to happen before all the 554 // Verifies that its ok for the unload notification to happen before all the
555 // listener removals. 555 // listener removals.
556 TEST_F(IdleTest, UnloadWhileListening) { 556 TEST_F(IdleTest, UnloadWhileListening) {
557 ScopedListen listen(idle_manager_, extension_->id()); 557 ScopedListen listen(idle_manager_, extension_->id());
558 UnloadedExtensionInfo details(extension_, 558 UnloadedExtensionInfo details(extension_.get(),
559 extension_misc::UNLOAD_REASON_UNINSTALL); 559 extension_misc::UNLOAD_REASON_UNINSTALL);
560 idle_manager_->Observe( 560 idle_manager_->Observe(
561 chrome::NOTIFICATION_EXTENSION_UNLOADED, 561 chrome::NOTIFICATION_EXTENSION_UNLOADED,
562 content::Source<Profile>(browser()->profile()), 562 content::Source<Profile>(browser()->profile()),
563 content::Details<UnloadedExtensionInfo>(&details)); 563 content::Details<UnloadedExtensionInfo>(&details));
564 } 564 }
565 565
566 } // namespace extensions 566 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/identity/identity_apitest.cc ('k') | chrome/browser/extensions/api/management/management_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698