| OLD | NEW |
| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| 11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
| 13 #include "content/public/browser/notification_types.h" | 13 #include "content/public/browser/notification_types.h" |
| 14 #include "content/public/browser/render_frame_host.h" | 14 #include "content/public/browser/render_frame_host.h" |
| 15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 16 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
| 17 #include "content/public/common/content_switches.h" | |
| 18 #include "content/public/test/browser_test_utils.h" | 17 #include "content/public/test/browser_test_utils.h" |
| 19 #include "content/public/test/content_browser_test_utils.h" | 18 #include "content/public/test/content_browser_test_utils.h" |
| 20 #include "content/public/test/test_utils.h" | 19 #include "content/public/test/test_utils.h" |
| 21 #include "net/dns/mock_host_resolver.h" | 20 #include "net/dns/mock_host_resolver.h" |
| 22 #include "net/test/embedded_test_server/embedded_test_server.h" | 21 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 23 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 24 | 23 |
| 25 class ChromeSitePerProcessTest : public InProcessBrowserTest { | 24 class ChromeSitePerProcessTest : public InProcessBrowserTest { |
| 26 public: | 25 public: |
| 27 ChromeSitePerProcessTest() {} | 26 ChromeSitePerProcessTest() {} |
| 28 ~ChromeSitePerProcessTest() override {} | 27 ~ChromeSitePerProcessTest() override {} |
| 29 | 28 |
| 30 void SetUpCommandLine(base::CommandLine* command_line) override { | 29 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 31 command_line->AppendSwitch(switches::kSitePerProcess); | 30 content::IsolateAllSitesForTesting(command_line); |
| 32 } | 31 } |
| 33 | 32 |
| 34 void SetUpOnMainThread() override { | 33 void SetUpOnMainThread() override { |
| 35 host_resolver()->AddRule("*", "127.0.0.1"); | 34 host_resolver()->AddRule("*", "127.0.0.1"); |
| 36 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 35 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 37 content::SetupCrossSiteRedirector(embedded_test_server()); | 36 content::SetupCrossSiteRedirector(embedded_test_server()); |
| 38 } | 37 } |
| 39 | 38 |
| 40 private: | 39 private: |
| 41 DISALLOW_COPY_AND_ASSIGN(ChromeSitePerProcessTest); | 40 DISALLOW_COPY_AND_ASSIGN(ChromeSitePerProcessTest); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 EXPECT_TRUE(ExecuteScriptAndExtractBool( | 93 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
| 95 frame_host, | 94 frame_host, |
| 96 "window.domAutomationController.send(!!openDatabase(" | 95 "window.domAutomationController.send(!!openDatabase(" |
| 97 "'foodb', '1.0', 'Test DB', 1024));", | 96 "'foodb', '1.0', 'Test DB', 1024));", |
| 98 &is_object_created)); | 97 &is_object_created)); |
| 99 EXPECT_TRUE(is_object_created); | 98 EXPECT_TRUE(is_object_created); |
| 100 EXPECT_TRUE(ExecuteScript(frame_host, | 99 EXPECT_TRUE(ExecuteScript(frame_host, |
| 101 "window.webkitRequestFileSystem(" | 100 "window.webkitRequestFileSystem(" |
| 102 "window.TEMPORARY, 1024, function() {});")); | 101 "window.TEMPORARY, 1024, function() {});")); |
| 103 } | 102 } |
| OLD | NEW |