| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/media/tab_desktop_media_list.h" | 5 #include "chrome/browser/media/tab_desktop_media_list.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 if (!entry) { | 132 if (!entry) { |
| 133 std::unique_ptr<content::NavigationEntry> entry_new = | 133 std::unique_ptr<content::NavigationEntry> entry_new = |
| 134 content::NavigationController::CreateNavigationEntry( | 134 content::NavigationController::CreateNavigationEntry( |
| 135 GURL("chrome://blank"), content::Referrer(), | 135 GURL("chrome://blank"), content::Referrer(), |
| 136 ui::PAGE_TRANSITION_LINK, false, std::string(), profile_); | 136 ui::PAGE_TRANSITION_LINK, false, std::string(), profile_); |
| 137 | 137 |
| 138 contents->GetController().SetTransientEntry(std::move(entry_new)); | 138 contents->GetController().SetTransientEntry(std::move(entry_new)); |
| 139 entry = contents->GetController().GetTransientEntry(); | 139 entry = contents->GetController().GetTransientEntry(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 entry->SetTitle(base::UTF8ToUTF16("Test tab")); | 142 contents->UpdateTitleForEntry(entry, base::ASCIIToUTF16("Test tab")); |
| 143 | 143 |
| 144 content::FaviconStatus favicon_info; | 144 content::FaviconStatus favicon_info; |
| 145 favicon_info.image = | 145 favicon_info.image = |
| 146 CreateGrayscaleImage(gfx::Size(10, 10), favicon_greyscale); | 146 CreateGrayscaleImage(gfx::Size(10, 10), favicon_greyscale); |
| 147 entry->GetFavicon() = favicon_info; | 147 entry->GetFavicon() = favicon_info; |
| 148 | 148 |
| 149 contents_array_.push_back(std::move(contents)); | 149 contents_array_.push_back(std::move(contents)); |
| 150 tab_strip_model->AppendWebContents(contents_array_.back().get(), false); | 150 tab_strip_model->AppendWebContents(contents_array_.back().get(), false); |
| 151 } | 151 } |
| 152 | 152 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 318 |
| 319 TEST_F(TabDesktopMediaListTest, UpdateTitle) { | 319 TEST_F(TabDesktopMediaListTest, UpdateTitle) { |
| 320 InitializeAndVerify(); | 320 InitializeAndVerify(); |
| 321 | 321 |
| 322 // Change tab's title. | 322 // Change tab's title. |
| 323 TabStripModel* tab_strip_model = browser_->tab_strip_model(); | 323 TabStripModel* tab_strip_model = browser_->tab_strip_model(); |
| 324 ASSERT_TRUE(tab_strip_model); | 324 ASSERT_TRUE(tab_strip_model); |
| 325 WebContents* contents = | 325 WebContents* contents = |
| 326 tab_strip_model->GetWebContentsAt(kDefaultSourceCount - 1); | 326 tab_strip_model->GetWebContentsAt(kDefaultSourceCount - 1); |
| 327 ASSERT_TRUE(contents); | 327 ASSERT_TRUE(contents); |
| 328 contents->GetController().GetTransientEntry()->SetTitle( | 328 const content::NavigationController& controller = contents->GetController(); |
| 329 base::UTF8ToUTF16("New test tab")); | 329 contents->UpdateTitleForEntry(controller.GetTransientEntry(), |
| 330 base::ASCIIToUTF16("New test tab")); |
| 330 | 331 |
| 331 EXPECT_CALL(observer_, OnSourceNameChanged(list_.get(), 0)) | 332 EXPECT_CALL(observer_, OnSourceNameChanged(list_.get(), 0)) |
| 332 .WillOnce(QuitMessageLoop()); | 333 .WillOnce(QuitMessageLoop()); |
| 333 | 334 |
| 334 base::RunLoop().Run(); | 335 base::RunLoop().Run(); |
| 335 | 336 |
| 336 EXPECT_EQ(list_->GetSource(0).name, base::UTF8ToUTF16("New test tab")); | 337 EXPECT_EQ(list_->GetSource(0).name, base::UTF8ToUTF16("New test tab")); |
| 337 | 338 |
| 338 list_.reset(); | 339 list_.reset(); |
| 339 } | 340 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 352 favicon_info.image = CreateGrayscaleImage(gfx::Size(10, 10), 100); | 353 favicon_info.image = CreateGrayscaleImage(gfx::Size(10, 10), 100); |
| 353 contents->GetController().GetTransientEntry()->GetFavicon() = favicon_info; | 354 contents->GetController().GetTransientEntry()->GetFavicon() = favicon_info; |
| 354 | 355 |
| 355 EXPECT_CALL(observer_, OnSourceThumbnailChanged(list_.get(), 0)) | 356 EXPECT_CALL(observer_, OnSourceThumbnailChanged(list_.get(), 0)) |
| 356 .WillOnce(QuitMessageLoop()); | 357 .WillOnce(QuitMessageLoop()); |
| 357 | 358 |
| 358 base::RunLoop().Run(); | 359 base::RunLoop().Run(); |
| 359 | 360 |
| 360 list_.reset(); | 361 list_.reset(); |
| 361 } | 362 } |
| OLD | NEW |