// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/apps/app_browsertest_util.h" #include "chrome/browser/extensions/extension_test_message_listener.h" #include "chrome/common/chrome_switches.h" #include "content/test/net/url_request_prepackaged_interceptor.h" #include "net/url_request/url_fetcher.h" class AdViewTest : public extensions::PlatformAppBrowserTest { protected: virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); command_line->AppendSwitch(switches::kEnableAdview); command_line->AppendSwitch(switches::kEnableAdviewSrcAttribute); } }; // This test checks the "loadcommit" event is called when the page inside an // is loaded. IN_PROC_BROWSER_TEST_F(AdViewTest, LoadCommitEventIsCalled) { ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest( "platform_apps/ad_view/loadcommit_event")) << message_; } // This test checks the "loadabort" event is called when the "src" attribute // of an is an invalid URL. IN_PROC_BROWSER_TEST_F(AdViewTest, LoadAbortEventIsCalled) { ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest( "platform_apps/ad_view/loadabort_event")) << message_; } // This test checks the page loaded inside an has the ability to // 1) receive "message" events from the application, and 2) use // "window.postMessage" to post back a message to the application. #if defined(OS_WIN) // Flaky, or takes too long time on Win7. (http://crbug.com/230271) #define MAYBE_CommitMessageFromAdNetwork DISABLED_CommitMessageFromAdNetwork #else #define MAYBE_CommitMessageFromAdNetwork CommitMessageFromAdNetwork #endif IN_PROC_BROWSER_TEST_F(AdViewTest, MAYBE_CommitMessageFromAdNetwork) { ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunPlatformAppTest( "platform_apps/ad_view/onloadcommit_ack")) << message_; } // This test checks the page running inside an has the ability to load // and display an image inside an