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

Side by Side Diff: chrome/browser/android/contextualsearch/contextual_search_delegate_unittest.cc

Issue 2440843002: [Contextual Search] Pipe basic quick action data from C++ to Java (Closed)
Patch Set: [Contextual Search] Pipe basic quick action data from C++ to Java Created 4 years, 1 month 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 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 "chrome/browser/android/contextualsearch/contextual_search_delegate.h" 5 #include "chrome/browser/android/contextualsearch/contextual_search_delegate.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 std::string search_term; 534 std::string search_term;
535 std::string display_text; 535 std::string display_text;
536 std::string alternate_term; 536 std::string alternate_term;
537 std::string mid; 537 std::string mid;
538 std::string prevent_preload; 538 std::string prevent_preload;
539 int mention_start; 539 int mention_start;
540 int mention_end; 540 int mention_end;
541 std::string context_language; 541 std::string context_language;
542 std::string thumbnail_url; 542 std::string thumbnail_url;
543 std::string caption; 543 std::string caption;
544 std::string quick_action_uri;
545 std::string quick_action_category;
544 delegate_->DecodeSearchTermFromJsonResponse( 546 delegate_->DecodeSearchTermFromJsonResponse(
545 json_with_escape, &search_term, &display_text, &alternate_term, 547 json_with_escape, &search_term, &display_text, &alternate_term,
546 &mid, &prevent_preload, &mention_start, &mention_end, &context_language, 548 &mid, &prevent_preload, &mention_start, &mention_end, &context_language,
547 &thumbnail_url, &caption); 549 &thumbnail_url, &caption, &quick_action_uri, &quick_action_category);
548 EXPECT_EQ("obama", search_term); 550 EXPECT_EQ("obama", search_term);
549 EXPECT_EQ("Barack Obama", display_text); 551 EXPECT_EQ("Barack Obama", display_text);
550 EXPECT_EQ("barack obama", alternate_term); 552 EXPECT_EQ("barack obama", alternate_term);
551 EXPECT_EQ("/m/02mjmr", mid); 553 EXPECT_EQ("/m/02mjmr", mid);
552 EXPECT_EQ("", prevent_preload); 554 EXPECT_EQ("", prevent_preload);
553 EXPECT_EQ("", context_language); 555 EXPECT_EQ("", context_language);
554 EXPECT_EQ("", thumbnail_url); 556 EXPECT_EQ("", thumbnail_url);
555 EXPECT_EQ("", caption); 557 EXPECT_EQ("", caption);
558 EXPECT_EQ("", quick_action_uri);
559 EXPECT_EQ("", quick_action_category);
556 } 560 }
557 561
558 TEST_F(ContextualSearchDelegateTest, ResponseWithLanguage) { 562 TEST_F(ContextualSearchDelegateTest, ResponseWithLanguage) {
559 CreateDefaultSearchContextAndRequestSearchTerm(); 563 CreateDefaultSearchContextAndRequestSearchTerm();
560 fetcher()->set_response_code(200); 564 fetcher()->set_response_code(200);
561 fetcher()->SetResponseString( 565 fetcher()->SetResponseString(
562 "{\"mid\":\"/m/02mjmr\",\"search_term\":\"obama\"," 566 "{\"mid\":\"/m/02mjmr\",\"search_term\":\"obama\","
563 "\"mentions\":[0,15],\"prevent_preload\":\"1\", " 567 "\"mentions\":[0,15],\"prevent_preload\":\"1\", "
564 "\"lang\":\"de\"}"); 568 "\"lang\":\"de\"}");
565 fetcher()->delegate()->OnURLFetchComplete(fetcher()); 569 fetcher()->delegate()->OnURLFetchComplete(fetcher());
(...skipping 26 matching lines...) Expand all
592 EXPECT_EQ("", thumbnail_url()); 596 EXPECT_EQ("", thumbnail_url());
593 } 597 }
594 598
595 // Test just the root level thumbnail. 599 // Test just the root level thumbnail.
596 TEST_F(ContextualSearchDelegateTest, ContextualCardsResponseWithThumbnail) { 600 TEST_F(ContextualSearchDelegateTest, ContextualCardsResponseWithThumbnail) {
597 CreateDefaultSearchWithAdditionalJsonData( 601 CreateDefaultSearchWithAdditionalJsonData(
598 ", |thumbnail|:|https://t0.gstatic.com/images?q=tbn:ANd9|"); 602 ", |thumbnail|:|https://t0.gstatic.com/images?q=tbn:ANd9|");
599 EXPECT_EQ("", caption()); 603 EXPECT_EQ("", caption());
600 EXPECT_EQ("https://t0.gstatic.com/images?q=tbn:ANd9", thumbnail_url()); 604 EXPECT_EQ("https://t0.gstatic.com/images?q=tbn:ANd9", thumbnail_url());
601 } 605 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698