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

Side by Side Diff: chrome/browser/ui/views/ime/ime_window_browsertest.cc

Issue 1756853002: Correctly sets the security origin for the IME window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed tests. Created 4 years, 9 months 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 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 "base/run_loop.h" 5 #include "base/run_loop.h"
6 #include "chrome/browser/ui/browser.h" 6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/ime/ime_native_window.h" 7 #include "chrome/browser/ui/ime/ime_native_window.h"
8 #include "chrome/browser/ui/ime/ime_window.h" 8 #include "chrome/browser/ui/ime/ime_window.h"
9 #include "chrome/browser/ui/ime/ime_window_observer.h" 9 #include "chrome/browser/ui/ime/ime_window_observer.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
10 #include "chrome/test/base/in_process_browser_test.h" 11 #include "chrome/test/base/in_process_browser_test.h"
11 #include "ui/views/widget/widget.h" 12 #include "ui/views/widget/widget.h"
12 13
13 namespace ui { 14 namespace ui {
14 namespace test { 15 namespace test {
15 16
16 class ImeWindowBrowserTest : public InProcessBrowserTest, 17 class ImeWindowBrowserTest : public InProcessBrowserTest,
17 public ImeWindowObserver { 18 public ImeWindowObserver {
18 public: 19 public:
19 ImeWindowBrowserTest() : ime_window_(nullptr) {} 20 ImeWindowBrowserTest() : ime_window_(nullptr) {}
(...skipping 13 matching lines...) Expand all
33 message_loop_runner_->Quit(); 34 message_loop_runner_->Quit();
34 } 35 }
35 36
36 void WaitForWindowClosing() { 37 void WaitForWindowClosing() {
37 message_loop_runner_.reset(new base::RunLoop); 38 message_loop_runner_.reset(new base::RunLoop);
38 message_loop_runner_->Run(); 39 message_loop_runner_->Run();
39 } 40 }
40 41
41 void CreateImeWindow(const gfx::Rect& bounds, bool follow_cursor) { 42 void CreateImeWindow(const gfx::Rect& bounds, bool follow_cursor) {
42 ime_window_ = new ImeWindow( 43 ime_window_ = new ImeWindow(
43 browser()->profile(), nullptr, "about:blank", 44 browser()->profile(), nullptr,
45 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(),
Devlin 2016/03/02 18:05:11 Does this RFH make sense as the opener?
Shu Chen 2016/03/03 01:33:32 Done. I've made it nullptr.
46 "about:blank",
44 follow_cursor ? ImeWindow::FOLLOW_CURSOR : ImeWindow::NORMAL, bounds); 47 follow_cursor ? ImeWindow::FOLLOW_CURSOR : ImeWindow::NORMAL, bounds);
45 ime_window_->AddObserver(this); 48 ime_window_->AddObserver(this);
46 EXPECT_FALSE(ime_window_->ime_native_window()->IsVisible()); 49 EXPECT_FALSE(ime_window_->ime_native_window()->IsVisible());
47 ime_window_->Show(); 50 ime_window_->Show();
48 EXPECT_TRUE(ime_window_->ime_native_window()->IsVisible()); 51 EXPECT_TRUE(ime_window_->ime_native_window()->IsVisible());
49 } 52 }
50 53
51 void VerifyImeWindow(const gfx::Rect& expected_bounds) { 54 void VerifyImeWindow(const gfx::Rect& expected_bounds) {
52 EXPECT_EQ(expected_bounds, 55 EXPECT_EQ(expected_bounds,
53 ime_window_->ime_native_window()->GetBounds()); 56 ime_window_->ime_native_window()->GetBounds());
(...skipping 23 matching lines...) Expand all
77 gfx::Rect expected_bounds(100, 200, 100, 100); 80 gfx::Rect expected_bounds(100, 200, 100, 100);
78 CreateImeWindow(expected_bounds, true); 81 CreateImeWindow(expected_bounds, true);
79 ime_window_->FollowCursor(gfx::Rect(10, 20, 1, 10)); 82 ime_window_->FollowCursor(gfx::Rect(10, 20, 1, 10));
80 expected_bounds.set_x(10); // cursor left. 83 expected_bounds.set_x(10); // cursor left.
81 expected_bounds.set_y(33); // cursor top + cursor height + margin(3). 84 expected_bounds.set_y(33); // cursor top + cursor height + margin(3).
82 VerifyImeWindow(expected_bounds); 85 VerifyImeWindow(expected_bounds);
83 } 86 }
84 87
85 } // namespace test 88 } // namespace test
86 } // namespace ui 89 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698