| 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 "chrome/app/chrome_command_ids.h" | 5 #include "chrome/app/chrome_command_ids.h" |
| 6 #include "chrome/browser/automation/automation_util.h" | 6 #include "chrome/browser/automation/automation_util.h" |
| 7 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 7 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 8 #include "chrome/browser/extensions/extension_test_message_listener.h" | 8 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 9 #include "chrome/browser/extensions/platform_app_browsertest_util.h" | 9 #include "chrome/browser/extensions/platform_app_browsertest_util.h" |
| 10 #include "chrome/browser/extensions/shell_window_registry.h" | 10 #include "chrome/browser/extensions/shell_window_registry.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, GetDisplayPath) { | 299 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, GetDisplayPath) { |
| 300 SetCommandLineArg("platform_apps/launch_files/test.txt"); | 300 SetCommandLineArg("platform_apps/launch_files/test.txt"); |
| 301 ASSERT_TRUE(RunPlatformAppTest("platform_apps/get_display_path")) | 301 ASSERT_TRUE(RunPlatformAppTest("platform_apps/get_display_path")) |
| 302 << message_; | 302 << message_; |
| 303 } | 303 } |
| 304 | 304 |
| 305 #endif // defined(OS_CHROMEOS) | 305 #endif // defined(OS_CHROMEOS) |
| 306 | 306 |
| 307 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenLink) { | 307 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenLink) { |
| 308 ASSERT_TRUE(StartTestServer()); | 308 ASSERT_TRUE(StartTestServer()); |
| 309 ui_test_utils::WindowedNotificationObserver observer( | 309 content::WindowedNotificationObserver observer( |
| 310 chrome::NOTIFICATION_TAB_ADDED, | 310 chrome::NOTIFICATION_TAB_ADDED, |
| 311 content::Source<content::WebContentsDelegate>(browser())); | 311 content::Source<content::WebContentsDelegate>(browser())); |
| 312 LoadAndLaunchPlatformApp("open_link"); | 312 LoadAndLaunchPlatformApp("open_link"); |
| 313 observer.Wait(); | 313 observer.Wait(); |
| 314 ASSERT_EQ(2, browser()->tab_count()); | 314 ASSERT_EQ(2, browser()->tab_count()); |
| 315 } | 315 } |
| 316 | 316 |
| 317 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, BrowserTag) { | 317 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, BrowserTag) { |
| 318 ASSERT_TRUE(RunPlatformAppTest("platform_apps/browser_tag")) << message_; | 318 ASSERT_TRUE(RunPlatformAppTest("platform_apps/browser_tag")) << message_; |
| 319 } | 319 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 341 automation_util::GetCookies(set_cookie_url, | 341 automation_util::GetCookies(set_cookie_url, |
| 342 chrome::GetWebContentsAt(browser(), 0), | 342 chrome::GetWebContentsAt(browser(), 0), |
| 343 &cookie_size, &cookie_value); | 343 &cookie_size, &cookie_value); |
| 344 ASSERT_EQ("testCookie=1", cookie_value); | 344 ASSERT_EQ("testCookie=1", cookie_value); |
| 345 | 345 |
| 346 // Create a listener to JS message to know when the app has launched. | 346 // Create a listener to JS message to know when the app has launched. |
| 347 ExtensionTestMessageListener launched_listener("Launched", false); | 347 ExtensionTestMessageListener launched_listener("Launched", false); |
| 348 LoadAndLaunchPlatformApp("browser_tag_isolation"); | 348 LoadAndLaunchPlatformApp("browser_tag_isolation"); |
| 349 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 349 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
| 350 | 350 |
| 351 ui_test_utils::WindowedNotificationObserver load_stop_observer( | 351 content::WindowedNotificationObserver load_stop_observer( |
| 352 content::NOTIFICATION_LOAD_STOP, | 352 content::NOTIFICATION_LOAD_STOP, |
| 353 content::NotificationService::AllSources()); | 353 content::NotificationService::AllSources()); |
| 354 load_stop_observer.Wait(); | 354 load_stop_observer.Wait(); |
| 355 content::Source<content::NavigationController> source = | 355 content::Source<content::NavigationController> source = |
| 356 load_stop_observer.source(); | 356 load_stop_observer.source(); |
| 357 | 357 |
| 358 // Test the regular browser context to ensure we still have only one cookie. | 358 // Test the regular browser context to ensure we still have only one cookie. |
| 359 automation_util::GetCookies(GURL("http://localhost"), | 359 automation_util::GetCookies(GURL("http://localhost"), |
| 360 chrome::GetWebContentsAt(browser(), 0), | 360 chrome::GetWebContentsAt(browser(), 0), |
| 361 &cookie_size, &cookie_value); | 361 &cookie_size, &cookie_value); |
| 362 ASSERT_EQ("testCookie=1", cookie_value); | 362 ASSERT_EQ("testCookie=1", cookie_value); |
| 363 | 363 |
| 364 ASSERT_TRUE(source->GetWebContents()->GetRenderProcessHost()->IsGuest()); | 364 ASSERT_TRUE(source->GetWebContents()->GetRenderProcessHost()->IsGuest()); |
| 365 | 365 |
| 366 // Now, test the browser tag to ensure we have properly set the cookie and | 366 // Now, test the browser tag to ensure we have properly set the cookie and |
| 367 // we have only one. | 367 // we have only one. |
| 368 automation_util::GetCookies(GURL("http://localhost"), | 368 automation_util::GetCookies(GURL("http://localhost"), |
| 369 source->GetWebContents(), | 369 source->GetWebContents(), |
| 370 &cookie_size, &cookie_value); | 370 &cookie_size, &cookie_value); |
| 371 ASSERT_EQ("isolation_guest=true", cookie_value); | 371 ASSERT_EQ("isolation_guest=true", cookie_value); |
| 372 } | 372 } |
| OLD | NEW |