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

Side by Side Diff: chrome/browser/notifications/platform_notification_service_unittest.cc

Issue 2919933002: Revert of ChromeOS: Per-user time zone: refactor tests first. (Closed)
Patch Set: Created 3 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
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 30 matching lines...) Expand all
41 #include "chrome/browser/extensions/extension_service.h" 41 #include "chrome/browser/extensions/extension_service.h"
42 #include "chrome/browser/extensions/test_extension_system.h" 42 #include "chrome/browser/extensions/test_extension_system.h"
43 #include "extensions/browser/extension_registry.h" 43 #include "extensions/browser/extension_registry.h"
44 #include "extensions/browser/process_map.h" 44 #include "extensions/browser/process_map.h"
45 #include "extensions/common/extension.h" 45 #include "extensions/common/extension.h"
46 #include "extensions/common/extension_builder.h" 46 #include "extensions/common/extension_builder.h"
47 #include "extensions/common/permissions/api_permission.h" 47 #include "extensions/common/permissions/api_permission.h"
48 #include "extensions/common/value_builder.h" 48 #include "extensions/common/value_builder.h"
49 #endif 49 #endif
50 50
51 #if BUILDFLAG(ENABLE_EXTENSIONS) && defined(OS_CHROMEOS)
52 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h"
53 #include "chrome/browser/chromeos/settings/cros_settings.h"
54 #include "chrome/browser/chromeos/settings/device_settings_service.h"
55 #endif
56
51 using content::NotificationResources; 57 using content::NotificationResources;
52 using content::PlatformNotificationData; 58 using content::PlatformNotificationData;
53 59
54 namespace { 60 namespace {
55 61
56 const char kNotificationId[] = "my-notification-id"; 62 const char kNotificationId[] = "my-notification-id";
57 const int kNotificationVibrationPattern[] = { 100, 200, 300 }; 63 const int kNotificationVibrationPattern[] = { 100, 200, 300 };
58 64
59 class MockDesktopNotificationDelegate 65 class MockDesktopNotificationDelegate
60 : public content::DesktopNotificationDelegate { 66 : public content::DesktopNotificationDelegate {
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 extensions::ExtensionRegistry::Get(profile()); 338 extensions::ExtensionRegistry::Get(profile());
333 EXPECT_TRUE(registry->AddEnabled(extension)); 339 EXPECT_TRUE(registry->AddEnabled(extension));
334 340
335 display_name = service()->DisplayNameForContextMessage( 341 display_name = service()->DisplayNameForContextMessage(
336 profile(), 342 profile(),
337 GURL("chrome-extension://honijodknafkokifofgiaalefdiedpko/main.html")); 343 GURL("chrome-extension://honijodknafkokifofgiaalefdiedpko/main.html"));
338 EXPECT_EQ("NotificationTest", base::UTF16ToUTF8(display_name)); 344 EXPECT_EQ("NotificationTest", base::UTF16ToUTF8(display_name));
339 } 345 }
340 346
341 TEST_F(PlatformNotificationServiceTest, ExtensionPermissionChecks) { 347 TEST_F(PlatformNotificationServiceTest, ExtensionPermissionChecks) {
348 #if defined(OS_CHROMEOS)
349 // The ExtensionService on Chrome OS requires these objects to be initialized.
350 chromeos::ScopedTestDeviceSettingsService test_device_settings_service;
351 chromeos::ScopedTestCrosSettings test_cros_settings;
352 chromeos::ScopedTestUserManager test_user_manager;
353 #endif
354
342 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); 355 base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
343 extensions::TestExtensionSystem* test_extension_system = 356 extensions::TestExtensionSystem* test_extension_system =
344 static_cast<extensions::TestExtensionSystem*>( 357 static_cast<extensions::TestExtensionSystem*>(
345 extensions::ExtensionSystem::Get(profile())); 358 extensions::ExtensionSystem::Get(profile()));
346 359
347 ExtensionService* extension_service = 360 ExtensionService* extension_service =
348 test_extension_system->CreateExtensionService( 361 test_extension_system->CreateExtensionService(
349 &command_line, base::FilePath() /* install_directory */, 362 &command_line, base::FilePath() /* install_directory */,
350 false /* autoupdate_enabled */); 363 false /* autoupdate_enabled */);
351 364
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 profile(), 433 profile(),
421 GURL() /* service_worker_scope */, 434 GURL() /* service_worker_scope */,
422 GURL("chrome-extension://honijodknafkokifofgiaalefdiedpko/main.html"), 435 GURL("chrome-extension://honijodknafkokifofgiaalefdiedpko/main.html"),
423 notification_data, NotificationResources(), 436 notification_data, NotificationResources(),
424 new MockNotificationDelegate("hello")); 437 new MockNotificationDelegate("hello"));
425 EXPECT_EQ("NotificationTest", 438 EXPECT_EQ("NotificationTest",
426 base::UTF16ToUTF8(notification.context_message())); 439 base::UTF16ToUTF8(notification.context_message()));
427 } 440 }
428 441
429 #endif // BUILDFLAG(ENABLE_EXTENSIONS) 442 #endif // BUILDFLAG(ENABLE_EXTENSIONS)
OLDNEW
« no previous file with comments | « chrome/browser/notifications/extension_welcome_notification_unittest.cc ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698