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

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

Issue 11233065: Rename <browser> shim to <webview> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT. No longer exposed to Extensions Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/browser_tag_browsertest.cc ('k') | chrome/browser_tests.isolate » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/automation/automation_util.h" 5 #include "chrome/browser/automation/automation_util.h"
6 #include "chrome/browser/extensions/platform_app_browsertest_util.h" 6 #include "chrome/browser/extensions/platform_app_browsertest_util.h"
7 #include "chrome/browser/ui/browser_tabstrip.h" 7 #include "chrome/browser/ui/browser_tabstrip.h"
8 #include "chrome/test/base/ui_test_utils.h" 8 #include "chrome/test/base/ui_test_utils.h"
9 #include "chrome/test/base/test_launcher_utils.h" 9 #include "chrome/test/base/test_launcher_utils.h"
10 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
11 #include "content/public/browser/render_process_host.h" 11 #include "content/public/browser/render_process_host.h"
12 #include "content/public/test/browser_test_utils.h" 12 #include "content/public/test/browser_test_utils.h"
13 #include "ui/compositor/compositor_setup.h" 13 #include "ui/compositor/compositor_setup.h"
14 #include "ui/gl/gl_switches.h" 14 #include "ui/gl/gl_switches.h"
15 15
16 class BrowserTagTest : public extensions::PlatformAppBrowserTest { 16 class WebViewTest : public extensions::PlatformAppBrowserTest {
17 protected: 17 protected:
18 virtual void SetUpCommandLine(CommandLine* command_line) { 18 virtual void SetUpCommandLine(CommandLine* command_line) {
19 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); 19 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line);
20 #if !defined(OS_MACOSX) 20 #if !defined(OS_MACOSX)
21 CHECK(test_launcher_utils::OverrideGLImplementation( 21 CHECK(test_launcher_utils::OverrideGLImplementation(
22 command_line, gfx::kGLImplementationOSMesaName)) << 22 command_line, gfx::kGLImplementationOSMesaName)) <<
23 "kUseGL must not be set by test framework code!"; 23 "kUseGL must not be set by test framework code!";
24 #endif 24 #endif
25 ui::DisableTestCompositor(); 25 ui::DisableTestCompositor();
26 } 26 }
27 }; 27 };
28 28
29 IN_PROC_BROWSER_TEST_F(BrowserTagTest, Shim) { 29 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim) {
30 ASSERT_TRUE(RunPlatformAppTest("platform_apps/browser_tag")) << message_; 30 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view")) << message_;
31 } 31 }
32 32
33 IN_PROC_BROWSER_TEST_F(BrowserTagTest, ShimSrcAttribute) { 33 IN_PROC_BROWSER_TEST_F(WebViewTest, ShimSrcAttribute) {
34 ASSERT_TRUE(RunPlatformAppTest("platform_apps/browser_tag_src_attribute")) 34 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view_src_attribute"))
35 << message_; 35 << message_;
36 } 36 }
37 37
38 IN_PROC_BROWSER_TEST_F(BrowserTagTest, Isolation) { 38 IN_PROC_BROWSER_TEST_F(WebViewTest, Isolation) {
39 ASSERT_TRUE(StartTestServer()); 39 ASSERT_TRUE(StartTestServer());
40 const std::wstring kExpire = 40 const std::wstring kExpire =
41 L"var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);"; 41 L"var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);";
42 std::wstring cookie_script1(kExpire); 42 std::wstring cookie_script1(kExpire);
43 cookie_script1.append( 43 cookie_script1.append(
44 L"document.cookie = 'guest1=true; path=/; expires=' + expire + ';';"); 44 L"document.cookie = 'guest1=true; path=/; expires=' + expire + ';';");
45 std::wstring cookie_script2(kExpire); 45 std::wstring cookie_script2(kExpire);
46 cookie_script2.append( 46 cookie_script2.append(
47 L"document.cookie = 'guest2=true; path=/; expires=' + expire + ';';"); 47 L"document.cookie = 'guest2=true; path=/; expires=' + expire + ';';");
48 48
49 GURL::Replacements replace_host; 49 GURL::Replacements replace_host;
50 std::string host_str("localhost"); // Must stay in scope with replace_host. 50 std::string host_str("localhost"); // Must stay in scope with replace_host.
51 replace_host.SetHostStr(host_str); 51 replace_host.SetHostStr(host_str);
52 52
53 GURL set_cookie_url = test_server()->GetURL( 53 GURL set_cookie_url = test_server()->GetURL(
54 "files/extensions/platform_apps/isolation/set_cookie.html"); 54 "files/extensions/platform_apps/isolation/set_cookie.html");
55 set_cookie_url = set_cookie_url.ReplaceComponents(replace_host); 55 set_cookie_url = set_cookie_url.ReplaceComponents(replace_host);
56 GURL tag_url1 = test_server()->GetURL( 56 GURL tag_url1 = test_server()->GetURL(
57 "files/extensions/platform_apps/browser_tag_isolation/cookie.html"); 57 "files/extensions/platform_apps/web_view_isolation/cookie.html");
58 tag_url1 = tag_url1.ReplaceComponents(replace_host); 58 tag_url1 = tag_url1.ReplaceComponents(replace_host);
59 GURL tag_url2 = test_server()->GetURL( 59 GURL tag_url2 = test_server()->GetURL(
60 "files/extensions/platform_apps/browser_tag_isolation/cookie2.html"); 60 "files/extensions/platform_apps/web_view_isolation/cookie2.html");
61 tag_url2 = tag_url2.ReplaceComponents(replace_host); 61 tag_url2 = tag_url2.ReplaceComponents(replace_host);
62 62
63 // Load a (non-app) page under the "localhost" origin that sets a cookie. 63 // Load a (non-app) page under the "localhost" origin that sets a cookie.
64 ui_test_utils::NavigateToURLWithDisposition( 64 ui_test_utils::NavigateToURLWithDisposition(
65 browser(), set_cookie_url, 65 browser(), set_cookie_url,
66 CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 66 CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
67 // Make sure the cookie is set. 67 // Make sure the cookie is set.
68 int cookie_size; 68 int cookie_size;
69 std::string cookie_value; 69 std::string cookie_value;
70 automation_util::GetCookies(set_cookie_url, 70 automation_util::GetCookies(set_cookie_url,
71 chrome::GetWebContentsAt(browser(), 0), 71 chrome::GetWebContentsAt(browser(), 0),
72 &cookie_size, &cookie_value); 72 &cookie_size, &cookie_value);
73 EXPECT_EQ("testCookie=1", cookie_value); 73 EXPECT_EQ("testCookie=1", cookie_value);
74 74
75 ui_test_utils::UrlLoadObserver observer1( 75 ui_test_utils::UrlLoadObserver observer1(
76 tag_url1, content::NotificationService::AllSources()); 76 tag_url1, content::NotificationService::AllSources());
77 ui_test_utils::UrlLoadObserver observer2( 77 ui_test_utils::UrlLoadObserver observer2(
78 tag_url2, content::NotificationService::AllSources()); 78 tag_url2, content::NotificationService::AllSources());
79 LoadAndLaunchPlatformApp("browser_tag_isolation"); 79 LoadAndLaunchPlatformApp("web_view_isolation");
80 observer1.Wait(); 80 observer1.Wait();
81 observer2.Wait(); 81 observer2.Wait();
82 82
83 content::Source<content::NavigationController> source1 = observer1.source(); 83 content::Source<content::NavigationController> source1 = observer1.source();
84 EXPECT_TRUE(source1->GetWebContents()->GetRenderProcessHost()->IsGuest()); 84 EXPECT_TRUE(source1->GetWebContents()->GetRenderProcessHost()->IsGuest());
85 content::Source<content::NavigationController> source2 = observer2.source(); 85 content::Source<content::NavigationController> source2 = observer2.source();
86 EXPECT_TRUE(source2->GetWebContents()->GetRenderProcessHost()->IsGuest()); 86 EXPECT_TRUE(source2->GetWebContents()->GetRenderProcessHost()->IsGuest());
87 EXPECT_NE(source1->GetWebContents()->GetRenderProcessHost()->GetID(), 87 EXPECT_NE(source1->GetWebContents()->GetRenderProcessHost()->GetID(),
88 source2->GetWebContents()->GetRenderProcessHost()->GetID()); 88 source2->GetWebContents()->GetRenderProcessHost()->GetID());
89 89
(...skipping 15 matching lines...) Expand all
105 automation_util::GetCookies(GURL("http://localhost"), 105 automation_util::GetCookies(GURL("http://localhost"),
106 source1->GetWebContents(), 106 source1->GetWebContents(),
107 &cookie_size, &cookie_value); 107 &cookie_size, &cookie_value);
108 EXPECT_EQ("guest1=true", cookie_value); 108 EXPECT_EQ("guest1=true", cookie_value);
109 109
110 automation_util::GetCookies(GURL("http://localhost"), 110 automation_util::GetCookies(GURL("http://localhost"),
111 source2->GetWebContents(), 111 source2->GetWebContents(),
112 &cookie_size, &cookie_value); 112 &cookie_size, &cookie_value);
113 EXPECT_EQ("guest2=true", cookie_value); 113 EXPECT_EQ("guest2=true", cookie_value);
114 } 114 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/browser_tag_browsertest.cc ('k') | chrome/browser_tests.isolate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698