| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 static const char kImageSearchPostParams[] = | 470 static const char kImageSearchPostParams[] = |
| 471 "thumb={google:imageThumbnail}"; | 471 "thumb={google:imageThumbnail}"; |
| 472 | 472 |
| 473 TemplateURLService* model = | 473 TemplateURLService* model = |
| 474 TemplateURLServiceFactory::GetForProfile(browser()->profile()); | 474 TemplateURLServiceFactory::GetForProfile(browser()->profile()); |
| 475 ASSERT_TRUE(model); | 475 ASSERT_TRUE(model); |
| 476 ui_test_utils::WaitForTemplateURLServiceToLoad(model); | 476 ui_test_utils::WaitForTemplateURLServiceToLoad(model); |
| 477 ASSERT_TRUE(model->loaded()); | 477 ASSERT_TRUE(model->loaded()); |
| 478 | 478 |
| 479 TemplateURLData data; | 479 TemplateURLData data; |
| 480 data.short_name = base::ASCIIToUTF16(kShortName); | 480 data.SetShortName(base::ASCIIToUTF16(kShortName)); |
| 481 data.SetKeyword(data.short_name); | 481 data.SetKeyword(data.short_name()); |
| 482 data.SetURL(test_server()->GetURL(kSearchURL).spec()); | 482 data.SetURL(test_server()->GetURL(kSearchURL).spec()); |
| 483 data.image_url = GetImageSearchURL().spec(); | 483 data.image_url = GetImageSearchURL().spec(); |
| 484 data.image_url_post_params = kImageSearchPostParams; | 484 data.image_url_post_params = kImageSearchPostParams; |
| 485 | 485 |
| 486 // The model takes ownership of |template_url|. | 486 // The model takes ownership of |template_url|. |
| 487 TemplateURL* template_url = new TemplateURL(data); | 487 TemplateURL* template_url = new TemplateURL(data); |
| 488 ASSERT_TRUE(model->Add(template_url)); | 488 ASSERT_TRUE(model->Add(template_url)); |
| 489 model->SetUserSelectedDefaultSearchProvider(template_url); | 489 model->SetUserSelectedDefaultSearchProvider(template_url); |
| 490 } | 490 } |
| 491 | 491 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 519 browser()->tab_strip_model()->GetActiveWebContents(); | 519 browser()->tab_strip_model()->GetActiveWebContents(); |
| 520 ThumbnailResponseWatcher watcher(tab->GetRenderProcessHost()); | 520 ThumbnailResponseWatcher watcher(tab->GetRenderProcessHost()); |
| 521 AttemptImageSearch(); | 521 AttemptImageSearch(); |
| 522 | 522 |
| 523 // The browser should receive a response from the renderer, because the | 523 // The browser should receive a response from the renderer, because the |
| 524 // renderer should not crash. | 524 // renderer should not crash. |
| 525 EXPECT_EQ(ThumbnailResponseWatcher::THUMBNAIL_RECEIVED, watcher.Wait()); | 525 EXPECT_EQ(ThumbnailResponseWatcher::THUMBNAIL_RECEIVED, watcher.Wait()); |
| 526 } | 526 } |
| 527 | 527 |
| 528 } // namespace | 528 } // namespace |
| OLD | NEW |