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

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

Issue 2527133002: Remove some WebContents::GetRenderViewHost() calls. (Closed)
Patch Set: More reverts for the same reason as patch set 3, fixes merge conflict Created 4 years 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 | « content/shell/browser/layout_test/blink_test_controller.cc ('k') | 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 (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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 CreateAlarm("[\"dup\", {\"delayInMinutes\": 1}]"); 287 CreateAlarm("[\"dup\", {\"delayInMinutes\": 1}]");
288 CreateAlarm("[\"dup\", {\"delayInMinutes\": 7}]"); 288 CreateAlarm("[\"dup\", {\"delayInMinutes\": 7}]");
289 289
290 alarm_manager_->GetAllAlarms( 290 alarm_manager_->GetAllAlarms(
291 extension()->id(), 291 extension()->id(),
292 base::Bind(ExtensionAlarmsTestCreateDupeGetAllAlarmsCallback)); 292 base::Bind(ExtensionAlarmsTestCreateDupeGetAllAlarmsCallback));
293 } 293 }
294 294
295 TEST_F(ExtensionAlarmsTest, CreateDelayBelowMinimum) { 295 TEST_F(ExtensionAlarmsTest, CreateDelayBelowMinimum) {
296 // Create an alarm with delay below the minimum accepted value. 296 // Create an alarm with delay below the minimum accepted value.
297 IPC::TestSink& sink = 297 IPC::TestSink& sink = static_cast<content::MockRenderProcessHost*>(
298 static_cast<content::MockRenderProcessHost*>( 298 contents()->GetMainFrame()->GetProcess())
299 contents()->GetRenderViewHost()->GetProcess())->sink(); 299 ->sink();
300 size_t initial_message_count = sink.message_count(); 300 size_t initial_message_count = sink.message_count();
301 CreateAlarm("[\"negative\", {\"delayInMinutes\": -0.2}]"); 301 CreateAlarm("[\"negative\", {\"delayInMinutes\": -0.2}]");
302 // A new message should have been added. 302 // A new message should have been added.
303 ASSERT_GT(sink.message_count(), initial_message_count); 303 ASSERT_GT(sink.message_count(), initial_message_count);
304 304
305 // All of this would be cleaner if we could read the message as a 305 // All of this would be cleaner if we could read the message as a
306 // FrameMsg_AddMessageToConsole, but that would be a layering violation. 306 // FrameMsg_AddMessageToConsole, but that would be a layering violation.
307 // Better yet would be an observer method for frames adding console messages, 307 // Better yet would be an observer method for frames adding console messages,
308 // but it's not worth adding just for a test. 308 // but it's not worth adding just for a test.
309 const IPC::Message* warning = 309 const IPC::Message* warning =
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 754
755 // The next poll should be the first poll that hasn't happened and is in-line 755 // The next poll should be the first poll that hasn't happened and is in-line
756 // with the original scheduling. 756 // with the original scheduling.
757 // Last poll was at 380 seconds; next poll should be at 480 seconds. 757 // Last poll was at 380 seconds; next poll should be at 480 seconds.
758 EXPECT_DOUBLE_EQ((alarm_manager_->last_poll_time_ + 758 EXPECT_DOUBLE_EQ((alarm_manager_->last_poll_time_ +
759 base::TimeDelta::FromSeconds(100)).ToJsTime(), 759 base::TimeDelta::FromSeconds(100)).ToJsTime(),
760 alarm_manager_->next_poll_time_.ToJsTime()); 760 alarm_manager_->next_poll_time_.ToJsTime());
761 } 761 }
762 762
763 } // namespace extensions 763 } // namespace extensions
OLDNEW
« no previous file with comments | « content/shell/browser/layout_test/blink_test_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698