Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "base/strings/utf_string_conversions.h" | |
|
apacible
2016/02/25 00:16:02
Are all of these needed?
amp
2016/02/25 03:01:15
Oops, no. This was from a previous patch that req
| |
| 8 #include "chrome/browser/prefs/browser_prefs.h" | |
| 9 #include "chrome/browser/signin/fake_signin_manager_builder.h" | |
| 10 #include "chrome/browser/signin/signin_manager_factory.h" | |
| 7 #include "chrome/browser/ui/browser_commands.h" | 11 #include "chrome/browser/ui/browser_commands.h" |
| 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 9 #include "chrome/browser/ui/webui/media_router/media_router_test.h" | 13 #include "chrome/browser/ui/webui/media_router/media_router_test.h" |
| 10 #include "chrome/browser/ui/webui/media_router/media_router_ui.h" | 14 #include "chrome/browser/ui/webui/media_router/media_router_ui.h" |
| 11 #include "chrome/browser/ui/webui/media_router/media_router_webui_message_handle r.h" | 15 #include "chrome/browser/ui/webui/media_router/media_router_webui_message_handle r.h" |
| 16 #include "chrome/test/base/testing_browser_process.h" | |
| 17 #include "components/signin/core/browser/signin_manager.h" | |
| 12 #include "content/public/browser/browser_context.h" | 18 #include "content/public/browser/browser_context.h" |
| 13 #include "content/public/test/test_web_ui.h" | 19 #include "content/public/test/test_web_ui.h" |
| 14 #include "extensions/common/constants.h" | 20 #include "extensions/common/constants.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 23 |
| 18 using testing::ReturnRef; | 24 using testing::ReturnRef; |
| 19 | 25 |
| 20 namespace media_router { | 26 namespace media_router { |
| 21 | 27 |
| 22 const char kProviderExtensionIdForTesting[] = "test_id"; | 28 const char kProviderExtensionIdForTesting[] = "test_id"; |
| 23 const char kControllerPathForTesting[] = "test_path"; | 29 const char kControllerPathForTesting[] = "test_path"; |
| 24 | 30 |
| 25 class MockMediaRouterUI : public MediaRouterUI { | 31 class MockMediaRouterUI : public MediaRouterUI { |
| 26 public: | 32 public: |
| 27 explicit MockMediaRouterUI(content::WebUI* web_ui) | 33 explicit MockMediaRouterUI(content::WebUI* web_ui) |
| 28 : MediaRouterUI(web_ui) {} | 34 : MediaRouterUI(web_ui) {} |
| 29 ~MockMediaRouterUI() {} | 35 ~MockMediaRouterUI() {} |
| 30 | 36 |
| 31 MOCK_CONST_METHOD0(GetRouteProviderExtensionId, const std::string&()); | 37 MOCK_CONST_METHOD0(GetRouteProviderExtensionId, const std::string&()); |
| 32 }; | 38 }; |
| 33 | 39 |
| 40 class TestMediaRouterWebUIMessageHandler | |
| 41 : public MediaRouterWebUIMessageHandler { | |
| 42 public: | |
| 43 explicit TestMediaRouterWebUIMessageHandler(MediaRouterUI* media_router_ui) | |
| 44 : MediaRouterWebUIMessageHandler(media_router_ui), | |
| 45 email_("nobody@example.com"), | |
| 46 domain_("example.com") {} | |
| 47 ~TestMediaRouterWebUIMessageHandler() override = default; | |
| 48 | |
| 49 AccountInfo GetAccountInfo() override { | |
| 50 AccountInfo info = AccountInfo(); | |
| 51 info.account_id = info.gaia = info.email = email_; | |
| 52 info.hosted_domain = domain_; | |
| 53 // info.hosted_domain = "NO_HOSTED_DOMAIN"; | |
|
apacible
2016/02/25 00:16:02
nit: Remove comment.
amp
2016/02/25 03:01:15
Done.
| |
| 54 info.full_name = info.given_name = "name"; | |
| 55 info.locale = "locale"; | |
| 56 info.picture_url = "picture"; | |
| 57 | |
| 58 return info; | |
| 59 } | |
| 60 | |
| 61 void SetEmailAndDomain(const std::string& email, const std::string& domain) { | |
| 62 email_ = email; | |
| 63 domain_ = domain; | |
| 64 } | |
| 65 | |
| 66 private: | |
| 67 std::string email_; | |
| 68 std::string domain_; | |
| 69 }; | |
| 70 | |
| 34 class MediaRouterWebUIMessageHandlerTest : public MediaRouterTest { | 71 class MediaRouterWebUIMessageHandlerTest : public MediaRouterTest { |
| 35 public: | 72 public: |
| 36 MediaRouterWebUIMessageHandlerTest() | 73 MediaRouterWebUIMessageHandlerTest() |
| 37 : web_ui_(new content::TestWebUI()), | 74 : web_ui_(new content::TestWebUI()), |
| 38 provider_extension_id_(kProviderExtensionIdForTesting) {} | 75 provider_extension_id_(kProviderExtensionIdForTesting) {} |
| 39 ~MediaRouterWebUIMessageHandlerTest() override {} | 76 ~MediaRouterWebUIMessageHandlerTest() override {} |
| 40 | 77 |
| 41 // BrowserWithTestWindowTest: | 78 // BrowserWithTestWindowTest: |
| 42 void SetUp() override { | 79 void SetUp() override { |
| 43 BrowserWithTestWindowTest::SetUp(); | 80 BrowserWithTestWindowTest::SetUp(); |
| 44 chrome::NewTab(browser()); | 81 chrome::NewTab(browser()); |
| 45 web_ui_->set_web_contents( | 82 web_ui_->set_web_contents( |
| 46 browser()->tab_strip_model()->GetActiveWebContents()); | 83 browser()->tab_strip_model()->GetActiveWebContents()); |
| 47 mock_media_router_ui_.reset(new MockMediaRouterUI(web_ui_.get())); | 84 mock_media_router_ui_.reset(new MockMediaRouterUI(web_ui_.get())); |
| 48 handler_.reset( | 85 handler_.reset( |
| 49 new MediaRouterWebUIMessageHandler(mock_media_router_ui_.get())); | 86 new TestMediaRouterWebUIMessageHandler(mock_media_router_ui_.get())); |
| 50 handler_->SetWebUIForTest(web_ui_.get()); | 87 handler_->SetWebUIForTest(web_ui_.get()); |
| 51 } | 88 } |
| 52 | 89 |
| 53 void TearDown() override { | 90 void TearDown() override { |
| 54 handler_.reset(); | 91 handler_.reset(); |
| 55 mock_media_router_ui_.reset(); | 92 mock_media_router_ui_.reset(); |
| 56 web_ui_.reset(); | 93 web_ui_.reset(); |
| 57 BrowserWithTestWindowTest::TearDown(); | 94 BrowserWithTestWindowTest::TearDown(); |
| 58 } | 95 } |
| 59 | 96 |
| 60 const std::string& provider_extension_id() const { | 97 const std::string& provider_extension_id() const { |
| 61 return provider_extension_id_; | 98 return provider_extension_id_; |
| 62 } | 99 } |
| 63 | 100 |
| 64 protected: | 101 protected: |
| 65 scoped_ptr<content::TestWebUI> web_ui_; | 102 scoped_ptr<content::TestWebUI> web_ui_; |
| 66 scoped_ptr<MockMediaRouterUI> mock_media_router_ui_; | 103 scoped_ptr<MockMediaRouterUI> mock_media_router_ui_; |
| 67 scoped_ptr<MediaRouterWebUIMessageHandler> handler_; | 104 scoped_ptr<TestMediaRouterWebUIMessageHandler> handler_; |
| 68 const std::string provider_extension_id_; | 105 const std::string provider_extension_id_; |
| 69 }; | 106 }; |
| 70 | 107 |
| 71 TEST_F(MediaRouterWebUIMessageHandlerTest, UpdateSinks) { | 108 TEST_F(MediaRouterWebUIMessageHandlerTest, UpdateSinks) { |
| 72 MediaSink::Id sink_id("sinkId123"); | 109 MediaSink::Id sink_id("sinkId123"); |
| 73 std::string sink_name("The sink"); | 110 std::string sink_name("The sink"); |
| 74 | 111 |
| 75 std::vector<MediaSinkWithCastModes> media_sink_with_cast_modes_list; | 112 std::vector<MediaSinkWithCastModes> media_sink_with_cast_modes_list; |
| 76 MediaSinkWithCastModes media_sink_with_cast_modes( | 113 MediaSinkWithCastModes media_sink_with_cast_modes( |
| 77 MediaSink(sink_id, sink_name, MediaSink::IconType::CAST)); | 114 MediaSink(sink_id, sink_name, MediaSink::IconType::CAST)); |
| 78 media_sink_with_cast_modes.cast_modes.insert(MediaCastMode::TAB_MIRROR); | 115 media_sink_with_cast_modes.cast_modes.insert(MediaCastMode::TAB_MIRROR); |
| 79 media_sink_with_cast_modes_list.push_back(media_sink_with_cast_modes); | 116 media_sink_with_cast_modes_list.push_back(media_sink_with_cast_modes); |
| 80 | 117 |
| 81 handler_->UpdateSinks(media_sink_with_cast_modes_list); | 118 handler_->UpdateSinks(media_sink_with_cast_modes_list); |
| 82 EXPECT_EQ(1u, web_ui_->call_data().size()); | 119 EXPECT_EQ(1u, web_ui_->call_data().size()); |
| 83 const content::TestWebUI::CallData& call_data = *web_ui_->call_data()[0]; | 120 const content::TestWebUI::CallData& call_data = *web_ui_->call_data()[0]; |
| 84 EXPECT_EQ("media_router.ui.setSinkList", call_data.function_name()); | 121 EXPECT_EQ("media_router.ui.setSinkListAndIdentity", |
| 122 call_data.function_name()); | |
| 85 const base::Value* arg1 = call_data.arg1(); | 123 const base::Value* arg1 = call_data.arg1(); |
| 124 const base::DictionaryValue* sinks_with_identity_value = nullptr; | |
| 125 ASSERT_TRUE(arg1->GetAsDictionary(&sinks_with_identity_value)); | |
| 126 | |
| 127 // Email is not displayed if there is no sinks with domain. | |
| 128 bool show_email = false; | |
| 129 bool actual_show_email = false; | |
| 130 EXPECT_TRUE( | |
| 131 sinks_with_identity_value->GetBoolean("showEmail", &actual_show_email)); | |
| 132 EXPECT_EQ(show_email, actual_show_email); | |
| 133 | |
| 134 // Domain is not displayed if there is no sinks with domain. | |
| 135 bool show_domain = false; | |
| 136 bool actual_show_domain = false; | |
| 137 EXPECT_TRUE( | |
| 138 sinks_with_identity_value->GetBoolean("showDomain", &actual_show_domain)); | |
| 139 EXPECT_EQ(show_domain, actual_show_domain); | |
| 140 | |
| 86 const base::ListValue* sinks_list_value = nullptr; | 141 const base::ListValue* sinks_list_value = nullptr; |
| 87 ASSERT_TRUE(arg1->GetAsList(&sinks_list_value)); | 142 ASSERT_TRUE(sinks_with_identity_value->GetList("sinks", &sinks_list_value)); |
| 88 const base::DictionaryValue* sink_value = nullptr; | 143 const base::DictionaryValue* sink_value = nullptr; |
| 89 ASSERT_TRUE(sinks_list_value->GetDictionary(0, &sink_value)); | 144 ASSERT_TRUE(sinks_list_value->GetDictionary(0, &sink_value)); |
| 90 | 145 |
| 91 std::string value; | 146 std::string value; |
| 92 EXPECT_TRUE(sink_value->GetString("id", &value)); | 147 EXPECT_TRUE(sink_value->GetString("id", &value)); |
| 93 EXPECT_EQ(sink_id, value); | 148 EXPECT_EQ(sink_id, value); |
| 94 | 149 |
| 95 EXPECT_TRUE(sink_value->GetString("name", &value)); | 150 EXPECT_TRUE(sink_value->GetString("name", &value)); |
| 96 EXPECT_EQ(sink_name, value); | 151 EXPECT_EQ(sink_name, value); |
| 97 | 152 |
| 98 int cast_mode_bits = -1; | 153 int cast_mode_bits = -1; |
| 99 ASSERT_TRUE(sink_value->GetInteger("castModes", &cast_mode_bits)); | 154 ASSERT_TRUE(sink_value->GetInteger("castModes", &cast_mode_bits)); |
| 100 EXPECT_EQ(static_cast<int>(MediaCastMode::TAB_MIRROR), cast_mode_bits); | 155 EXPECT_EQ(static_cast<int>(MediaCastMode::TAB_MIRROR), cast_mode_bits); |
| 101 } | 156 } |
| 102 | 157 |
| 158 #if defined(GOOGLE_CHROME_BUILD) | |
| 159 TEST_F(MediaRouterWebUIMessageHandlerTest, UpdateSinksWithIdentity) { | |
| 160 MediaSink::Id sink_id("sinkId123"); | |
| 161 std::string sink_name("The sink"); | |
| 162 std::string user_email("nobody@example.com"); | |
|
apacible
2016/02/25 00:16:02
Pull out the actual user email/domain into constan
amp
2016/02/25 03:01:15
Done.
| |
| 163 std::string domain_name("example.com"); | |
| 164 | |
| 165 std::vector<MediaSinkWithCastModes> media_sink_with_cast_modes_list; | |
| 166 MediaSinkWithCastModes media_sink_with_cast_modes( | |
| 167 MediaSink(sink_id, sink_name, MediaSink::IconType::CAST)); | |
| 168 media_sink_with_cast_modes.sink.set_domain(domain_name); | |
| 169 media_sink_with_cast_modes.cast_modes.insert(MediaCastMode::TAB_MIRROR); | |
| 170 media_sink_with_cast_modes_list.push_back(media_sink_with_cast_modes); | |
| 171 | |
| 172 handler_->UpdateSinks(media_sink_with_cast_modes_list); | |
| 173 EXPECT_EQ(1u, web_ui_->call_data().size()); | |
| 174 const content::TestWebUI::CallData& call_data = *web_ui_->call_data()[0]; | |
| 175 EXPECT_EQ("media_router.ui.setSinkListAndIdentity", | |
| 176 call_data.function_name()); | |
| 177 const base::Value* arg1 = call_data.arg1(); | |
| 178 const base::DictionaryValue* sinks_with_identity_value = nullptr; | |
| 179 ASSERT_TRUE(arg1->GetAsDictionary(&sinks_with_identity_value)); | |
| 180 | |
| 181 bool show_email = true; | |
| 182 bool actual_show_email = false; | |
| 183 EXPECT_TRUE( | |
| 184 sinks_with_identity_value->GetBoolean("showEmail", &actual_show_email)); | |
| 185 EXPECT_EQ(show_email, actual_show_email); | |
| 186 | |
| 187 // Sink domain is not displayed if it matches user domain. | |
| 188 bool show_domain = false; | |
| 189 bool actual_show_domain = false; | |
| 190 EXPECT_TRUE( | |
| 191 sinks_with_identity_value->GetBoolean("showDomain", &actual_show_domain)); | |
| 192 EXPECT_EQ(show_domain, actual_show_domain); | |
| 193 | |
| 194 std::string value; | |
| 195 EXPECT_TRUE(sinks_with_identity_value->GetString("userEmail", &value)); | |
| 196 EXPECT_EQ(user_email, value); | |
| 197 | |
| 198 EXPECT_TRUE(sinks_with_identity_value->GetString("userDomain", &value)); | |
| 199 EXPECT_EQ(domain_name, value); | |
| 200 } | |
| 201 | |
| 202 TEST_F(MediaRouterWebUIMessageHandlerTest, UpdateSinksWithIdentityAndDomain) { | |
| 203 MediaSink::Id sink_id("sinkId123"); | |
| 204 std::string sink_name("The sink"); | |
| 205 std::string user_email("nobody@example.com"); | |
| 206 std::string user_domain("example.com"); | |
| 207 std::string domain_name("google.com"); | |
| 208 | |
| 209 std::vector<MediaSinkWithCastModes> media_sink_with_cast_modes_list; | |
| 210 MediaSinkWithCastModes media_sink_with_cast_modes( | |
| 211 MediaSink(sink_id, sink_name, MediaSink::IconType::CAST)); | |
| 212 media_sink_with_cast_modes.sink.set_domain(domain_name); | |
| 213 media_sink_with_cast_modes.cast_modes.insert(MediaCastMode::TAB_MIRROR); | |
| 214 media_sink_with_cast_modes_list.push_back(media_sink_with_cast_modes); | |
| 215 | |
| 216 handler_->UpdateSinks(media_sink_with_cast_modes_list); | |
| 217 EXPECT_EQ(1u, web_ui_->call_data().size()); | |
| 218 const content::TestWebUI::CallData& call_data = *web_ui_->call_data()[0]; | |
| 219 EXPECT_EQ("media_router.ui.setSinkListAndIdentity", | |
| 220 call_data.function_name()); | |
| 221 const base::Value* arg1 = call_data.arg1(); | |
| 222 const base::DictionaryValue* sinks_with_identity_value = nullptr; | |
| 223 ASSERT_TRUE(arg1->GetAsDictionary(&sinks_with_identity_value)); | |
| 224 | |
| 225 // Domain is displayed for sinks with domains that are not the user domain. | |
| 226 bool show_domain = true; | |
| 227 bool actual_show_domain = false; | |
| 228 EXPECT_TRUE( | |
| 229 sinks_with_identity_value->GetBoolean("showDomain", &actual_show_domain)); | |
| 230 EXPECT_EQ(show_domain, actual_show_domain); | |
| 231 | |
| 232 std::string value; | |
| 233 EXPECT_TRUE(sinks_with_identity_value->GetString("userDomain", &value)); | |
| 234 EXPECT_EQ(user_domain, value); | |
| 235 } | |
| 236 | |
| 237 TEST_F(MediaRouterWebUIMessageHandlerTest, UpdateSinksWithNoDomain) { | |
| 238 MediaSink::Id sink_id("sinkId123"); | |
| 239 std::string sink_name("The sink"); | |
| 240 std::string user_email("nobody@example.com"); | |
| 241 std::string user_domain("NO_HOSTED_DOMAIN"); | |
| 242 std::string domain_name("default"); | |
| 243 | |
| 244 handler_->SetEmailAndDomain(user_email, user_domain); | |
| 245 | |
| 246 std::vector<MediaSinkWithCastModes> media_sink_with_cast_modes_list; | |
| 247 MediaSinkWithCastModes media_sink_with_cast_modes( | |
| 248 MediaSink(sink_id, sink_name, MediaSink::IconType::CAST)); | |
| 249 media_sink_with_cast_modes.sink.set_domain(domain_name); | |
| 250 media_sink_with_cast_modes.cast_modes.insert(MediaCastMode::TAB_MIRROR); | |
| 251 media_sink_with_cast_modes_list.push_back(media_sink_with_cast_modes); | |
| 252 | |
| 253 handler_->UpdateSinks(media_sink_with_cast_modes_list); | |
| 254 EXPECT_EQ(1u, web_ui_->call_data().size()); | |
| 255 const content::TestWebUI::CallData& call_data = *web_ui_->call_data()[0]; | |
| 256 EXPECT_EQ("media_router.ui.setSinkListAndIdentity", | |
| 257 call_data.function_name()); | |
| 258 const base::Value* arg1 = call_data.arg1(); | |
| 259 const base::DictionaryValue* sinks_with_identity_value = nullptr; | |
| 260 ASSERT_TRUE(arg1->GetAsDictionary(&sinks_with_identity_value)); | |
| 261 | |
| 262 const base::ListValue* sinks_list_value = nullptr; | |
| 263 ASSERT_TRUE(sinks_with_identity_value->GetList("sinks", &sinks_list_value)); | |
| 264 const base::DictionaryValue* sink_value = nullptr; | |
| 265 ASSERT_TRUE(sinks_list_value->GetDictionary(0, &sink_value)); | |
| 266 | |
| 267 // Domain should not be shown if there were only default sink domains. | |
| 268 bool show_domain = false; | |
| 269 bool actual_show_domain = false; | |
| 270 EXPECT_TRUE( | |
| 271 sinks_with_identity_value->GetBoolean("showDomain", &actual_show_domain)); | |
| 272 EXPECT_EQ(show_domain, actual_show_domain); | |
| 273 | |
| 274 // Sink domain should be empty if user has no hosted domain. | |
| 275 std::string value; | |
| 276 EXPECT_TRUE(sink_value->GetString("domain", &value)); | |
| 277 EXPECT_EQ(std::string(), value); | |
| 278 | |
| 279 EXPECT_TRUE(sinks_with_identity_value->GetString("userDomain", &value)); | |
| 280 EXPECT_EQ(user_domain, value); | |
| 281 } | |
| 282 | |
| 283 TEST_F(MediaRouterWebUIMessageHandlerTest, UpdateSinksWithDefaultDomain) { | |
| 284 MediaSink::Id sink_id("sinkId123"); | |
| 285 std::string sink_name("The sink"); | |
| 286 std::string user_email("nobody@example.com"); | |
| 287 std::string user_domain("example.com"); | |
| 288 std::string domain_name("default"); | |
| 289 | |
| 290 std::vector<MediaSinkWithCastModes> media_sink_with_cast_modes_list; | |
| 291 MediaSinkWithCastModes media_sink_with_cast_modes( | |
| 292 MediaSink(sink_id, sink_name, MediaSink::IconType::CAST)); | |
| 293 media_sink_with_cast_modes.sink.set_domain(domain_name); | |
| 294 media_sink_with_cast_modes.cast_modes.insert(MediaCastMode::TAB_MIRROR); | |
| 295 media_sink_with_cast_modes_list.push_back(media_sink_with_cast_modes); | |
| 296 | |
| 297 handler_->UpdateSinks(media_sink_with_cast_modes_list); | |
| 298 EXPECT_EQ(1u, web_ui_->call_data().size()); | |
| 299 const content::TestWebUI::CallData& call_data = *web_ui_->call_data()[0]; | |
| 300 EXPECT_EQ("media_router.ui.setSinkListAndIdentity", | |
| 301 call_data.function_name()); | |
| 302 const base::Value* arg1 = call_data.arg1(); | |
| 303 const base::DictionaryValue* sinks_with_identity_value = nullptr; | |
| 304 ASSERT_TRUE(arg1->GetAsDictionary(&sinks_with_identity_value)); | |
| 305 | |
| 306 const base::ListValue* sinks_list_value = nullptr; | |
| 307 ASSERT_TRUE(sinks_with_identity_value->GetList("sinks", &sinks_list_value)); | |
| 308 const base::DictionaryValue* sink_value = nullptr; | |
| 309 ASSERT_TRUE(sinks_list_value->GetDictionary(0, &sink_value)); | |
| 310 | |
| 311 // Domain should not be shown if there were only default sink domains. | |
| 312 bool show_domain = false; | |
| 313 bool actual_show_domain = false; | |
| 314 EXPECT_TRUE( | |
| 315 sinks_with_identity_value->GetBoolean("showDomain", &actual_show_domain)); | |
| 316 EXPECT_EQ(show_domain, actual_show_domain); | |
| 317 | |
| 318 std::string value; | |
| 319 EXPECT_TRUE(sinks_with_identity_value->GetString("userDomain", &value)); | |
| 320 EXPECT_EQ(user_domain, value); | |
| 321 | |
| 322 // Sink domain should be updated from 'default' to user_domain. | |
| 323 EXPECT_TRUE(sink_value->GetString("domain", &value)); | |
| 324 EXPECT_EQ(user_domain, value); | |
| 325 } | |
| 326 #endif // defined(GOOGLE_CHROME_BUILD) | |
| 327 | |
| 103 TEST_F(MediaRouterWebUIMessageHandlerTest, UpdateRoutes) { | 328 TEST_F(MediaRouterWebUIMessageHandlerTest, UpdateRoutes) { |
| 104 MediaRoute::Id route_id("routeId123"); | 329 MediaRoute::Id route_id("routeId123"); |
| 105 MediaSink::Id sink_id("sinkId123"); | 330 MediaSink::Id sink_id("sinkId123"); |
| 106 MediaSink sink(sink_id, "The sink", MediaSink::IconType::CAST); | 331 MediaSink sink(sink_id, "The sink", MediaSink::IconType::CAST); |
| 107 MediaSource media_source("mediaSource"); | 332 MediaSource media_source("mediaSource"); |
| 108 std::string description("This is a route"); | 333 std::string description("This is a route"); |
| 109 bool is_local = true; | 334 bool is_local = true; |
| 110 std::vector<MediaRoute> routes; | 335 std::vector<MediaRoute> routes; |
| 111 routes.push_back(MediaRoute(route_id, media_source, sink_id, | 336 routes.push_back(MediaRoute(route_id, media_source, sink_id, |
| 112 description, is_local, kControllerPathForTesting, | 337 description, is_local, kControllerPathForTesting, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 | 455 |
| 231 EXPECT_TRUE(issue_value->GetString("routeId", &value)); | 456 EXPECT_TRUE(issue_value->GetString("routeId", &value)); |
| 232 EXPECT_EQ(route_id, value); | 457 EXPECT_EQ(route_id, value); |
| 233 | 458 |
| 234 bool actual_is_blocking = false; | 459 bool actual_is_blocking = false; |
| 235 EXPECT_TRUE(issue_value->GetBoolean("isBlocking", &actual_is_blocking)); | 460 EXPECT_TRUE(issue_value->GetBoolean("isBlocking", &actual_is_blocking)); |
| 236 EXPECT_EQ(is_blocking, actual_is_blocking); | 461 EXPECT_EQ(is_blocking, actual_is_blocking); |
| 237 } | 462 } |
| 238 | 463 |
| 239 } // namespace media_router | 464 } // namespace media_router |
| OLD | NEW |