blob: 278e07a1c90bf479297dbca00e76ff2e5861dc3d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
// 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);
}
};
// This test checks that <adview> attributes are also exposed as properties
// (with the same name and value).
#if defined(OS_WIN)
// Flaky on Win XP. (http://crbug.com/264362)
#define MAYBE_PropertiesAreInSyncWithAttributes \
DISABLED_PropertiesAreInSyncWithAttributes
#else
#define MAYBE_PropertiesAreInSyncWithAttributes \
PropertiesAreInSyncWithAttributes
#endif
IN_PROC_BROWSER_TEST_F(AdViewTest, MAYBE_PropertiesAreInSyncWithAttributes) {
ASSERT_TRUE(StartEmbeddedTestServer());
ASSERT_TRUE(RunPlatformAppTest(
"platform_apps/ad_view/properties_exposed")) << message_;
}
// This test checks an invalid "ad-network" value (i.e. not whitelisted)
// is ignored.
IN_PROC_BROWSER_TEST_F(AdViewTest, InvalidAdNetworkIsIgnored) {
ASSERT_TRUE(StartEmbeddedTestServer());
ASSERT_TRUE(RunPlatformAppTest(
"platform_apps/ad_view/invalid_ad_network")) << message_;
}
class AdViewNotEnabledTest : public extensions::PlatformAppBrowserTest {
protected:
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line);
//Note: The "kEnableAdview" flag is not here!
}
};
// This test checks an <adview> element has no behavior when the "kEnableAdview"
// flag is missing.
IN_PROC_BROWSER_TEST_F(AdViewNotEnabledTest, EnableAdviewFlagRequired) {
ASSERT_TRUE(StartEmbeddedTestServer());
ASSERT_TRUE(RunPlatformAppTest(
"platform_apps/ad_view/flag_required")) << message_;
}
|