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

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationRequestTest.cpp

Issue 2148643002: [Presentation API] Adds DOMString[] constructor to PresentationRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix LayoutTests Created 4 years, 5 months 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "modules/presentation/PresentationRequest.h"
6
7 #include "bindings/core/v8/V8BindingForTesting.h"
8 #include "core/dom/ExceptionCode.h"
9 #include "platform/weborigin/KURL.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace blink {
13 namespace {
14
15 TEST(PresentationRequestTest, TestSingleUrlConstructor)
16 {
17 V8TestingScope scope;
18 PresentationRequest* request = PresentationRequest::create(scope.getExecutio nContext(), "https://example.com", scope.getExceptionState());
19 ASSERT_FALSE(scope.getExceptionState().hadException());
20 WTF::Vector<KURL> requestUrls = request->urls();
21 EXPECT_EQ(requestUrls.size(), static_cast<size_t>(1));
22 EXPECT_TRUE(requestUrls[0].isValid());
23 EXPECT_EQ(requestUrls[0].getString(), "https://example.com/");
24 }
25
26 TEST(PresentationRequestTest, TestMultipleUrlConstructor)
27 {
28 V8TestingScope scope;
29 WTF::Vector<String> urls;
30 urls.append("https://example.com");
31 urls.append("cast://deadbeef?param=foo");
32
33 PresentationRequest* request = PresentationRequest::create(scope.getExecutio nContext(), urls, scope.getExceptionState());
34 ASSERT_FALSE(scope.getExceptionState().hadException());
35 WTF::Vector<KURL> requestUrls = request->urls();
36 EXPECT_EQ(static_cast<size_t>(2), requestUrls.size());
37 EXPECT_TRUE(requestUrls[0].isValid());
38 EXPECT_EQ("https://example.com/", requestUrls[0].getString());
39 EXPECT_TRUE(requestUrls[1].isValid());
40 EXPECT_EQ("cast://deadbeef?param=foo", requestUrls[1].getString());
41 }
42
43 TEST(PresentationRequestTest, TestMultipleUrlConstructorInvalidUrl)
44 {
45 V8TestingScope scope;
46 WTF::Vector<String> urls;
47 urls.append("https://example.com");
48 urls.append("");
49
50 PresentationRequest::create(scope.getExecutionContext(), urls, scope.getExce ptionState());
51 EXPECT_TRUE(scope.getExceptionState().hadException());
52 EXPECT_EQ(V8TypeError, scope.getExceptionState().code());
53 }
54
55 } // anonymous namespace
56 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698