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

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

Issue 11823052: Fix alarms_api_unittest.cc on GCC 4.6.3 linux 64 with -Werror=uninitialized: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 (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/mock_time_provider.h" 7 #include "base/test/mock_time_provider.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/api/alarms/alarm_manager.h" 9 #include "chrome/browser/extensions/api/alarms/alarm_manager.h"
10 #include "chrome/browser/extensions/api/alarms/alarms_api.h" 10 #include "chrome/browser/extensions/api/alarms/alarms_api.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 } 270 }
271 271
272 TEST_F(ExtensionAlarmsTest, CreateDelayBelowMinimum) { 272 TEST_F(ExtensionAlarmsTest, CreateDelayBelowMinimum) {
273 // Create an alarm with delay below the minimum accepted value. 273 // Create an alarm with delay below the minimum accepted value.
274 CreateAlarm("[\"negative\", {\"delayInMinutes\": -0.2}]"); 274 CreateAlarm("[\"negative\", {\"delayInMinutes\": -0.2}]");
275 IPC::TestSink& sink = static_cast<content::MockRenderProcessHost*>( 275 IPC::TestSink& sink = static_cast<content::MockRenderProcessHost*>(
276 contents_->GetRenderViewHost()->GetProcess())->sink(); 276 contents_->GetRenderViewHost()->GetProcess())->sink();
277 const IPC::Message* warning = sink.GetUniqueMessageMatching( 277 const IPC::Message* warning = sink.GetUniqueMessageMatching(
278 ExtensionMsg_AddMessageToConsole::ID); 278 ExtensionMsg_AddMessageToConsole::ID);
279 ASSERT_TRUE(warning); 279 ASSERT_TRUE(warning);
280 content::ConsoleMessageLevel level; 280 content::ConsoleMessageLevel level = content::CONSOLE_MESSAGE_LEVEL_TIP;
281 std::string message; 281 std::string message;
282 ExtensionMsg_AddMessageToConsole::Read(warning, &level, &message); 282 ExtensionMsg_AddMessageToConsole::Read(warning, &level, &message);
283 EXPECT_EQ(content::CONSOLE_MESSAGE_LEVEL_WARNING, level); 283 EXPECT_EQ(content::CONSOLE_MESSAGE_LEVEL_WARNING, level);
284 EXPECT_THAT(message, testing::HasSubstr("delay is less than minimum of 1")); 284 EXPECT_THAT(message, testing::HasSubstr("delay is less than minimum of 1"));
285 } 285 }
286 286
287 TEST_F(ExtensionAlarmsTest, Get) { 287 TEST_F(ExtensionAlarmsTest, Get) {
288 current_time_ = base::Time::FromDoubleT(4); 288 current_time_ = base::Time::FromDoubleT(4);
289 289
290 // Create 2 alarms, and make sure we can query them. 290 // Create 2 alarms, and make sure we can query them.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 EXPECT_TRUE(alarm_manager_->timer_.IsRunning()); 515 EXPECT_TRUE(alarm_manager_->timer_.IsRunning());
516 MessageLoop::current()->Run(); 516 MessageLoop::current()->Run();
517 EXPECT_FALSE(alarm_manager_->timer_.IsRunning()); 517 EXPECT_FALSE(alarm_manager_->timer_.IsRunning());
518 CreateAlarm("[\"bb\", {\"delayInMinutes\": 10}]"); 518 CreateAlarm("[\"bb\", {\"delayInMinutes\": 10}]");
519 EXPECT_TRUE(alarm_manager_->timer_.IsRunning()); 519 EXPECT_TRUE(alarm_manager_->timer_.IsRunning());
520 alarm_manager_->RemoveAllAlarms(extension_->id()); 520 alarm_manager_->RemoveAllAlarms(extension_->id());
521 EXPECT_FALSE(alarm_manager_->timer_.IsRunning()); 521 EXPECT_FALSE(alarm_manager_->timer_.IsRunning());
522 } 522 }
523 523
524 } // namespace extensions 524 } // namespace extensions
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