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

Side by Side Diff: chrome/browser/extensions/service_worker_apitest.cc

Issue 2835233002: Fix integration tests in src/chrome and src/extensions so that we can turn on IO thread checks wi... (Closed)
Patch Set: ready for review Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/threading/thread_restrictions.h"
11 #include "chrome/browser/extensions/extension_apitest.h" 12 #include "chrome/browser/extensions/extension_apitest.h"
12 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/gcm/fake_gcm_profile_service.h" 14 #include "chrome/browser/gcm/fake_gcm_profile_service.h"
14 #include "chrome/browser/gcm/gcm_profile_service_factory.h" 15 #include "chrome/browser/gcm/gcm_profile_service_factory.h"
15 #include "chrome/browser/notifications/desktop_notification_profile_util.h" 16 #include "chrome/browser/notifications/desktop_notification_profile_util.h"
16 #include "chrome/browser/notifications/notification_display_service_factory.h" 17 #include "chrome/browser/notifications/notification_display_service_factory.h"
17 #include "chrome/browser/notifications/stub_notification_display_service.h" 18 #include "chrome/browser/notifications/stub_notification_display_service.h"
18 #include "chrome/browser/permissions/permission_manager.h" 19 #include "chrome/browser/permissions/permission_manager.h"
19 #include "chrome/browser/permissions/permission_result.h" 20 #include "chrome/browser/permissions/permission_result.h"
20 #include "chrome/browser/push_messaging/push_messaging_app_identifier.h" 21 #include "chrome/browser/push_messaging/push_messaging_app_identifier.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 PushMessagingServiceImpl* push_service_; 277 PushMessagingServiceImpl* push_service_;
277 278
278 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerPushMessagingTest); 279 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerPushMessagingTest);
279 }; 280 };
280 281
281 IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, RegisterSucceeds) { 282 IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, RegisterSucceeds) {
282 StartTestFromBackgroundPage("register.js", kExpectSuccess); 283 StartTestFromBackgroundPage("register.js", kExpectSuccess);
283 } 284 }
284 285
285 IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, UpdateRefreshesServiceWorker) { 286 IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, UpdateRefreshesServiceWorker) {
287 base::ThreadRestrictions::ScopedAllowIO allow_io;
286 base::ScopedTempDir scoped_temp_dir; 288 base::ScopedTempDir scoped_temp_dir;
287 ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); 289 ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir());
288 base::FilePath pem_path = test_data_dir_.AppendASCII("service_worker") 290 base::FilePath pem_path = test_data_dir_.AppendASCII("service_worker")
289 .AppendASCII("update") 291 .AppendASCII("update")
290 .AppendASCII("service_worker.pem"); 292 .AppendASCII("service_worker.pem");
291 base::FilePath path_v1 = 293 base::FilePath path_v1 =
292 PackExtensionWithOptions(test_data_dir_.AppendASCII("service_worker") 294 PackExtensionWithOptions(test_data_dir_.AppendASCII("service_worker")
293 .AppendASCII("update") 295 .AppendASCII("update")
294 .AppendASCII("v1"), 296 .AppendASCII("v1"),
295 scoped_temp_dir.GetPath().AppendASCII("v1.crx"), 297 scoped_temp_dir.GetPath().AppendASCII("v1.crx"),
(...skipping 20 matching lines...) Expand all
316 318
317 // Update to version 2.0. 319 // Update to version 2.0.
318 EXPECT_TRUE(UpdateExtension(kId, path_v2, 0)); 320 EXPECT_TRUE(UpdateExtension(kId, path_v2, 0));
319 EXPECT_TRUE(extensions::ExtensionRegistry::Get(profile()) 321 EXPECT_TRUE(extensions::ExtensionRegistry::Get(profile())
320 ->enabled_extensions() 322 ->enabled_extensions()
321 .GetByID(kId)); 323 .GetByID(kId));
322 EXPECT_TRUE(listener_v2.WaitUntilSatisfied()); 324 EXPECT_TRUE(listener_v2.WaitUntilSatisfied());
323 } 325 }
324 326
325 IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, UpdateWithoutSkipWaiting) { 327 IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, UpdateWithoutSkipWaiting) {
328 base::ThreadRestrictions::ScopedAllowIO allow_io;
326 base::ScopedTempDir scoped_temp_dir; 329 base::ScopedTempDir scoped_temp_dir;
327 ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); 330 ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir());
328 base::FilePath pem_path = test_data_dir_.AppendASCII("service_worker") 331 base::FilePath pem_path = test_data_dir_.AppendASCII("service_worker")
329 .AppendASCII("update_without_skip_waiting") 332 .AppendASCII("update_without_skip_waiting")
330 .AppendASCII("update_without_skip_waiting.pem"); 333 .AppendASCII("update_without_skip_waiting.pem");
331 base::FilePath path_v1 = 334 base::FilePath path_v1 =
332 PackExtensionWithOptions(test_data_dir_.AppendASCII("service_worker") 335 PackExtensionWithOptions(test_data_dir_.AppendASCII("service_worker")
333 .AppendASCII("update_without_skip_waiting") 336 .AppendASCII("update_without_skip_waiting")
334 .AppendASCII("v1"), 337 .AppendASCII("v1"),
335 scoped_temp_dir.GetPath().AppendASCII("v1.crx"), 338 scoped_temp_dir.GetPath().AppendASCII("v1.crx"),
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 message.sender_id = "1234567890"; 878 message.sender_id = "1234567890";
876 message.raw_data = "testdata"; 879 message.raw_data = "testdata";
877 message.decrypted = true; 880 message.decrypted = true;
878 push_service()->SetMessageCallbackForTesting(run_loop.QuitClosure()); 881 push_service()->SetMessageCallbackForTesting(run_loop.QuitClosure());
879 push_service()->OnMessage(app_identifier.app_id(), message); 882 push_service()->OnMessage(app_identifier.app_id(), message);
880 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied()); 883 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied());
881 run_loop.Run(); // Wait until the message is handled by push service. 884 run_loop.Run(); // Wait until the message is handled by push service.
882 } 885 }
883 886
884 } // namespace extensions 887 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/lazy_background_page_apitest.cc ('k') | chrome/browser/extensions/startup_helper_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698