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

Side by Side Diff: chrome/browser/media/router/discovery/dial/dial_device_data_unittest.cc

Issue 2756483007: [Device Discovery] Move files from browser/extensions/api/dial to browser/media/router/discovery/di… (Closed)
Patch Set: resolve code review comments from Devlin Created 3 years, 9 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
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/extensions/api/dial/dial_device_data.h" 5 #include "chrome/browser/media/router/discovery/dial/dial_device_data.h"
6 #include "chrome/common/extensions/api/dial.h"
7 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
8 7
9 namespace extensions { 8 namespace media_router {
10 namespace api {
11 namespace dial {
12 9
13 namespace { 10 namespace {
14 11
15 // Asserts equality between the two objects. 12 // Asserts equality between the two objects.
16 void ExpectEqual(const DialDeviceData& first, const DialDeviceData& second) { 13 void ExpectEqual(const DialDeviceData& first, const DialDeviceData& second) {
17 EXPECT_EQ(first.device_id(), second.device_id()); 14 EXPECT_EQ(first.device_id(), second.device_id());
18 EXPECT_EQ(first.label(), second.label()); 15 EXPECT_EQ(first.label(), second.label());
19 EXPECT_EQ(first.device_description_url(), second.device_description_url()); 16 EXPECT_EQ(first.device_description_url(), second.device_description_url());
20 EXPECT_EQ(first.response_time(), second.response_time()); 17 EXPECT_EQ(first.response_time(), second.response_time());
21 EXPECT_EQ(first.max_age(), second.max_age()); 18 EXPECT_EQ(first.max_age(), second.max_age());
22 EXPECT_EQ(first.config_id(), second.config_id()); 19 EXPECT_EQ(first.config_id(), second.config_id());
23 } 20 }
24 21
25 } // namespace 22 } // namespace
26 23
27 TEST(DialDeviceDataTest, TestFillDialDevice) {
28 api::dial::DialDevice api_device;
29
30 DialDeviceData device;
31 device.set_device_id("device");
32 device.set_label("label");
33 device.set_device_description_url(GURL("http://127.0.0.1/dd.xml"));
34 device.set_config_id(1);
35
36 device.FillDialDevice(&api_device);
37 EXPECT_EQ(api_device.device_label, device.label());
38 EXPECT_EQ(api_device.device_description_url,
39 device.device_description_url().spec());
40 EXPECT_EQ(*(api_device.config_id), device.config_id());
41 }
42
43 TEST(DialDeviceDataTest, TestUpdateFrom) { 24 TEST(DialDeviceDataTest, TestUpdateFrom) {
44 DialDeviceData original; 25 DialDeviceData original;
45 original.set_device_id("device_a"); 26 original.set_device_id("device_a");
46 original.set_label("label_a"); 27 original.set_label("label_a");
47 original.set_device_description_url(GURL("http://127.0.0.1/dd-a.xml")); 28 original.set_device_description_url(GURL("http://127.0.0.1/dd-a.xml"));
48 original.set_response_time(base::Time::FromInternalValue(1000)); 29 original.set_response_time(base::Time::FromInternalValue(1000));
49 original.set_max_age(100); 30 original.set_max_age(100);
50 original.set_config_id(1); 31 original.set_config_id(1);
51 32
52 DialDeviceData new_data; 33 DialDeviceData new_data;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 GURL("http://192.168.1.1:1234/dd.xml"))); 77 GURL("http://192.168.1.1:1234/dd.xml")));
97 EXPECT_TRUE(DialDeviceData::IsDeviceDescriptionUrl( 78 EXPECT_TRUE(DialDeviceData::IsDeviceDescriptionUrl(
98 GURL("https://192.168.1.1:1234/dd.xml"))); 79 GURL("https://192.168.1.1:1234/dd.xml")));
99 80
100 EXPECT_FALSE(DialDeviceData::IsDeviceDescriptionUrl(GURL())); 81 EXPECT_FALSE(DialDeviceData::IsDeviceDescriptionUrl(GURL()));
101 EXPECT_FALSE(DialDeviceData::IsDeviceDescriptionUrl(GURL(std::string()))); 82 EXPECT_FALSE(DialDeviceData::IsDeviceDescriptionUrl(GURL(std::string())));
102 EXPECT_FALSE( 83 EXPECT_FALSE(
103 DialDeviceData::IsDeviceDescriptionUrl(GURL("file://path/to/file"))); 84 DialDeviceData::IsDeviceDescriptionUrl(GURL("file://path/to/file")));
104 } 85 }
105 86
106 } // namespace dial 87 } // namespace media_router
107 } // namespace api
108 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698