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

Side by Side Diff: extensions/browser/api/alarms/alarms_api_unittest.cc

Issue 1389163008: Don't use base::MessageLoop::{Quit,QuitClosure} in extensions/, ipc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | extensions/browser/api_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This file tests the chrome.alarms extension API. 5 // This file tests the chrome.alarms extension API.
6 6
7 #include "base/test/simple_test_clock.h" 7 #include "base/test/simple_test_clock.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "content/public/test/mock_render_process_host.h" 10 #include "content/public/test/mock_render_process_host.h"
(...skipping 14 matching lines...) Expand all
25 25
26 namespace { 26 namespace {
27 27
28 // Test delegate which quits the message loop when an alarm fires. 28 // Test delegate which quits the message loop when an alarm fires.
29 class AlarmDelegate : public AlarmManager::Delegate { 29 class AlarmDelegate : public AlarmManager::Delegate {
30 public: 30 public:
31 ~AlarmDelegate() override {} 31 ~AlarmDelegate() override {}
32 void OnAlarm(const std::string& extension_id, const Alarm& alarm) override { 32 void OnAlarm(const std::string& extension_id, const Alarm& alarm) override {
33 alarms_seen.push_back(alarm.js_alarm->name); 33 alarms_seen.push_back(alarm.js_alarm->name);
34 if (base::MessageLoop::current()->is_running()) 34 if (base::MessageLoop::current()->is_running())
35 base::MessageLoop::current()->Quit(); 35 base::MessageLoop::current()->QuitWhenIdle();
36 } 36 }
37 37
38 std::vector<std::string> alarms_seen; 38 std::vector<std::string> alarms_seen;
39 }; 39 };
40 40
41 } // namespace 41 } // namespace
42 42
43 void RunScheduleNextPoll(AlarmManager* alarm_manager) { 43 void RunScheduleNextPoll(AlarmManager* alarm_manager) {
44 alarm_manager->ScheduleNextPoll(); 44 alarm_manager->ScheduleNextPoll();
45 } 45 }
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 689
690 // The next poll should be the first poll that hasn't happened and is in-line 690 // The next poll should be the first poll that hasn't happened and is in-line
691 // with the original scheduling. 691 // with the original scheduling.
692 // Last poll was at 380 seconds; next poll should be at 480 seconds. 692 // Last poll was at 380 seconds; next poll should be at 480 seconds.
693 EXPECT_DOUBLE_EQ((alarm_manager_->last_poll_time_ + 693 EXPECT_DOUBLE_EQ((alarm_manager_->last_poll_time_ +
694 base::TimeDelta::FromSeconds(100)).ToJsTime(), 694 base::TimeDelta::FromSeconds(100)).ToJsTime(),
695 alarm_manager_->next_poll_time_.ToJsTime()); 695 alarm_manager_->next_poll_time_.ToJsTime());
696 } 696 }
697 697
698 } // namespace extensions 698 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/api_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698