OLD | NEW |
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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 10 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 using content::WebContents; | 42 using content::WebContents; |
43 using extensions::Extension; | 43 using extensions::Extension; |
44 | 44 |
45 class AppApiTest : public ExtensionApiTest { | 45 class AppApiTest : public ExtensionApiTest { |
46 protected: | 46 protected: |
47 // Gets the base URL for files for a specific test, making sure that it uses | 47 // Gets the base URL for files for a specific test, making sure that it uses |
48 // "localhost" as the hostname, since that is what the extent is declared | 48 // "localhost" as the hostname, since that is what the extent is declared |
49 // as in the test apps manifests. | 49 // as in the test apps manifests. |
50 GURL GetTestBaseURL(const std::string& test_directory) { | 50 GURL GetTestBaseURL(const std::string& test_directory) { |
51 GURL::Replacements replace_host; | 51 GURL::Replacements replace_host; |
52 std::string host_str("localhost"); // must stay in scope with replace_host | 52 replace_host.SetHostStr("localhost"); |
53 replace_host.SetHostStr(host_str); | |
54 GURL base_url = embedded_test_server()->GetURL( | 53 GURL base_url = embedded_test_server()->GetURL( |
55 "/extensions/api_test/" + test_directory + "/"); | 54 "/extensions/api_test/" + test_directory + "/"); |
56 return base_url.ReplaceComponents(replace_host); | 55 return base_url.ReplaceComponents(replace_host); |
57 } | 56 } |
58 | 57 |
59 // Pass flags to make testing apps easier. | 58 // Pass flags to make testing apps easier. |
60 void SetUpCommandLine(base::CommandLine* command_line) override { | 59 void SetUpCommandLine(base::CommandLine* command_line) override { |
61 ExtensionApiTest::SetUpCommandLine(command_line); | 60 ExtensionApiTest::SetUpCommandLine(command_line); |
62 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 61 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
63 switches::kDisablePopupBlocking); | 62 switches::kDisablePopupBlocking); |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 // Navigate the popup to another process outside the app. | 860 // Navigate the popup to another process outside the app. |
862 GURL non_app_url(base_url.Resolve("path3/empty.html")); | 861 GURL non_app_url(base_url.Resolve("path3/empty.html")); |
863 ui_test_utils::NavigateToURL(active_browser_list->get(1), non_app_url); | 862 ui_test_utils::NavigateToURL(active_browser_list->get(1), non_app_url); |
864 SiteInstance* new_instance = popup_contents->GetSiteInstance(); | 863 SiteInstance* new_instance = popup_contents->GetSiteInstance(); |
865 EXPECT_NE(app_instance, new_instance); | 864 EXPECT_NE(app_instance, new_instance); |
866 | 865 |
867 // It should still be in the same BrowsingInstance, allowing postMessage to | 866 // It should still be in the same BrowsingInstance, allowing postMessage to |
868 // work. | 867 // work. |
869 EXPECT_TRUE(app_instance->IsRelatedSiteInstance(new_instance)); | 868 EXPECT_TRUE(app_instance->IsRelatedSiteInstance(new_instance)); |
870 } | 869 } |
OLD | NEW |