| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <sstream> | 5 #include <sstream> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram_base.h" | 8 #include "base/metrics/histogram_base.h" |
| 9 #include "base/metrics/histogram_samples.h" | 9 #include "base/metrics/histogram_samples.h" |
| 10 #include "base/metrics/statistics_recorder.h" | 10 #include "base/metrics/statistics_recorder.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 #include "net/url_request/url_fetcher_impl.h" | 81 #include "net/url_request/url_fetcher_impl.h" |
| 82 #include "net/url_request/url_request_status.h" | 82 #include "net/url_request/url_request_status.h" |
| 83 #include "testing/gmock/include/gmock/gmock.h" | 83 #include "testing/gmock/include/gmock/gmock.h" |
| 84 #include "third_party/skia/include/core/SkBitmap.h" | 84 #include "third_party/skia/include/core/SkBitmap.h" |
| 85 #include "ui/base/l10n/l10n_util.h" | 85 #include "ui/base/l10n/l10n_util.h" |
| 86 | 86 |
| 87 using testing::HasSubstr; | 87 using testing::HasSubstr; |
| 88 | 88 |
| 89 namespace { | 89 namespace { |
| 90 | 90 |
| 91 // Creates a bitmap of the specified color. Caller takes ownership. | |
| 92 gfx::Image CreateBitmap(SkColor color) { | |
| 93 SkBitmap thumbnail; | |
| 94 thumbnail.setConfig(SkBitmap::kARGB_8888_Config, 4, 4); | |
| 95 thumbnail.allocPixels(); | |
| 96 thumbnail.eraseColor(color); | |
| 97 return gfx::Image::CreateFrom1xBitmap(thumbnail); // adds ref. | |
| 98 } | |
| 99 | |
| 100 // Task used to make sure history has finished processing a request. Intended | 91 // Task used to make sure history has finished processing a request. Intended |
| 101 // for use with BlockUntilHistoryProcessesPendingRequests. | 92 // for use with BlockUntilHistoryProcessesPendingRequests. |
| 102 class QuittingHistoryDBTask : public history::HistoryDBTask { | 93 class QuittingHistoryDBTask : public history::HistoryDBTask { |
| 103 public: | 94 public: |
| 104 QuittingHistoryDBTask() {} | 95 QuittingHistoryDBTask() {} |
| 105 | 96 |
| 106 virtual bool RunOnDBThread(history::HistoryBackend* backend, | 97 virtual bool RunOnDBThread(history::HistoryBackend* backend, |
| 107 history::HistoryDatabase* db) OVERRIDE { | 98 history::HistoryDatabase* db) OVERRIDE { |
| 108 return true; | 99 return true; |
| 109 } | 100 } |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 stream << "link.href = \"" << result_url.spec() << "\";"; | 1031 stream << "link.href = \"" << result_url.spec() << "\";"; |
| 1041 stream << "document.body.appendChild(link);"; | 1032 stream << "document.body.appendChild(link);"; |
| 1042 stream << "link.click();"; | 1033 stream << "link.click();"; |
| 1043 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); | 1034 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); |
| 1044 | 1035 |
| 1045 content::WaitForLoadStop(contents); | 1036 content::WaitForLoadStop(contents); |
| 1046 std::string expected_title = | 1037 std::string expected_title = |
| 1047 "Referrer is " + instant_url().GetWithEmptyPath().spec(); | 1038 "Referrer is " + instant_url().GetWithEmptyPath().spec(); |
| 1048 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); | 1039 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); |
| 1049 } | 1040 } |
| OLD | NEW |