| 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/ui/views/intent_picker_bubble_view.h" |    5 #include "chrome/browser/ui/views/intent_picker_bubble_view.h" | 
|    6  |    6  | 
|    7 #include "base/bind.h" |    7 #include "base/bind.h" | 
|    8 #include "base/bind_helpers.h" |    8 #include "base/bind_helpers.h" | 
|    9 #include "base/callback.h" |    9 #include "base/callback.h" | 
|   10 #include "base/macros.h" |   10 #include "base/macros.h" | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
|   40     // Pushing a couple of fake apps just to check they are created on the UI. |   40     // Pushing a couple of fake apps just to check they are created on the UI. | 
|   41     app_info_.emplace_back("dank app 1", gfx::Image()); |   41     app_info_.emplace_back("dank app 1", gfx::Image()); | 
|   42     app_info_.emplace_back("dank app 2", gfx::Image()); |   42     app_info_.emplace_back("dank app 2", gfx::Image()); | 
|   43  |   43  | 
|   44     if (use_icons) |   44     if (use_icons) | 
|   45       FillAppListWithDummyIcons(); |   45       FillAppListWithDummyIcons(); | 
|   46  |   46  | 
|   47     // We create |web_contents| since the Bubble UI has an Observer that |   47     // We create |web_contents| since the Bubble UI has an Observer that | 
|   48     // depends on this, otherwise it wouldn't work. |   48     // depends on this, otherwise it wouldn't work. | 
|   49     GURL url("http://www.google.com"); |   49     GURL url("http://www.google.com"); | 
|   50     WebContents* web_contents = browser()->OpenURL(OpenURLParams( |   50     WebContents* web_contents = browser()->OpenURL( | 
|   51         url, Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false)); |   51         OpenURLParams(url, Referrer(), WindowOpenDisposition::CURRENT_TAB, | 
 |   52                       ui::PAGE_TRANSITION_TYPED, false)); | 
|   52  |   53  | 
|   53     bubble_ = IntentPickerBubbleView::CreateBubbleView( |   54     bubble_ = IntentPickerBubbleView::CreateBubbleView( | 
|   54         app_info_, base::Bind(&IntentPickerBubbleViewTest::OnBubbleClosed, |   55         app_info_, base::Bind(&IntentPickerBubbleViewTest::OnBubbleClosed, | 
|   55                               base::Unretained(this)), |   56                               base::Unretained(this)), | 
|   56         web_contents); |   57         web_contents); | 
|   57   } |   58   } | 
|   58  |   59  | 
|   59   void FillAppListWithDummyIcons() { |   60   void FillAppListWithDummyIcons() { | 
|   60     ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |   61     ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 
|   61     gfx::Image dummy_icon = rb.GetImageNamed(IDR_CLOSE); |   62     gfx::Image dummy_icon = rb.GetImageNamed(IDR_CLOSE); | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   95         app->GetImage(views::Button::ButtonState::STATE_NORMAL).isNull()) << i; |   96         app->GetImage(views::Button::ButtonState::STATE_NORMAL).isNull()) << i; | 
|   96   } |   97   } | 
|   97 } |   98 } | 
|   98  |   99  | 
|   99 // Verifies that the bubble contains as many rows as the input. Populated the |  100 // Verifies that the bubble contains as many rows as the input. Populated the | 
|  100 // bubble with an arbitrary image in every row. |  101 // bubble with an arbitrary image in every row. | 
|  101 TEST_F(IntentPickerBubbleViewTest, LabelsPtrVectorSize) { |  102 TEST_F(IntentPickerBubbleViewTest, LabelsPtrVectorSize) { | 
|  102   CreateBubbleView(true); |  103   CreateBubbleView(true); | 
|  103   EXPECT_EQ(app_info_.size(), bubble_->app_info_.size()); |  104   EXPECT_EQ(app_info_.size(), bubble_->app_info_.size()); | 
|  104 } |  105 } | 
| OLD | NEW |