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

Side by Side Diff: chrome/browser/chrome_service_worker_browsertest.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 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 // This file tests that Service Workers (a Content feature) work in the Chromium 5 // This file tests that Service Workers (a Content feature) work in the Chromium
6 // embedder. 6 // embedder.
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
11 #include "base/numerics/safe_conversions.h" 11 #include "base/numerics/safe_conversions.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/threading/thread_restrictions.h"
15 #include "build/build_config.h" 16 #include "build/build_config.h"
16 #include "chrome/browser/chrome_notification_types.h" 17 #include "chrome/browser/chrome_notification_types.h"
17 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 18 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
18 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 19 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
19 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_window.h" 22 #include "chrome/browser/ui/browser_window.h"
22 #include "chrome/browser/ui/tabs/tab_strip_model.h" 23 #include "chrome/browser/ui/tabs/tab_strip_model.h"
23 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
24 #include "chrome/test/base/in_process_browser_test.h" 25 #include "chrome/test/base/in_process_browser_test.h"
(...skipping 15 matching lines...) Expand all
40 ChromeServiceWorkerTest() { 41 ChromeServiceWorkerTest() {
41 EXPECT_TRUE(service_worker_dir_.CreateUniqueTempDir()); 42 EXPECT_TRUE(service_worker_dir_.CreateUniqueTempDir());
42 EXPECT_TRUE(base::CreateDirectoryAndGetError( 43 EXPECT_TRUE(base::CreateDirectoryAndGetError(
43 service_worker_dir_.GetPath().Append( 44 service_worker_dir_.GetPath().Append(
44 FILE_PATH_LITERAL("scope")), nullptr)); 45 FILE_PATH_LITERAL("scope")), nullptr));
45 } 46 }
46 ~ChromeServiceWorkerTest() override {} 47 ~ChromeServiceWorkerTest() override {}
47 48
48 void WriteFile(const base::FilePath::StringType& filename, 49 void WriteFile(const base::FilePath::StringType& filename,
49 base::StringPiece contents) { 50 base::StringPiece contents) {
51 base::ThreadRestrictions::ScopedAllowIO allow_io;
50 EXPECT_EQ(base::checked_cast<int>(contents.size()), 52 EXPECT_EQ(base::checked_cast<int>(contents.size()),
51 base::WriteFile(service_worker_dir_.GetPath().Append(filename), 53 base::WriteFile(service_worker_dir_.GetPath().Append(filename),
52 contents.data(), contents.size())); 54 contents.data(), contents.size()));
53 } 55 }
54 56
55 base::ScopedTempDir service_worker_dir_; 57 base::ScopedTempDir service_worker_dir_;
56 58
57 private: 59 private:
58 DISALLOW_COPY_AND_ASSIGN(ChromeServiceWorkerTest); 60 DISALLOW_COPY_AND_ASSIGN(ChromeServiceWorkerTest);
59 }; 61 };
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 ExecutePNACLUrlLoaderTest("OtherCredentials")); 605 ExecutePNACLUrlLoaderTest("OtherCredentials"));
604 } 606 }
605 607
606 IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPIPrivateTest, 608 IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPIPrivateTest,
607 OtherOriginCORSCredentials) { 609 OtherOriginCORSCredentials) {
608 EXPECT_EQ(GetRequestStringForPNACL("#OtherCORSCredentials"), 610 EXPECT_EQ(GetRequestStringForPNACL("#OtherCORSCredentials"),
609 ExecutePNACLUrlLoaderTest("OtherCORSCredentials")); 611 ExecutePNACLUrlLoaderTest("OtherCORSCredentials"));
610 } 612 }
611 613
612 } // namespace 614 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698