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

Side by Side Diff: components/web_view/web_view_apptest.cc

Issue 1674903003: Extract shell methods from ApplicationImpl into a base class, and pass this to Initialize() instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojom
Patch Set: . Created 4 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/web_view/public/cpp/web_view.h" 5 #include "components/web_view/public/cpp/web_view.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 private: 91 private:
92 void QuitNestedRunLoop() { 92 void QuitNestedRunLoop() {
93 if (run_loop_) { 93 if (run_loop_) {
94 quit_condition_ = NO_QUIT; 94 quit_condition_ = NO_QUIT;
95 run_loop_->Quit(); 95 run_loop_->Quit();
96 } 96 }
97 } 97 }
98 98
99 // Overridden from ApplicationDelegate: 99 // Overridden from ApplicationDelegate:
100 void Initialize(mojo::ApplicationImpl* app) override { 100 void Initialize(mojo::Shell* shell, const std::string& url,
101 WindowServerTestBase::Initialize(app); 101 uint32_t id) override {
102 app_ = app; 102 WindowServerTestBase::Initialize(shell, url, id);
103 shell_ = shell;
103 } 104 }
104 105
105 // Overridden from WindowTreeDelegate: 106 // Overridden from WindowTreeDelegate:
106 void OnEmbed(mus::Window* root) override { 107 void OnEmbed(mus::Window* root) override {
107 content_ = root->connection()->NewWindow(); 108 content_ = root->connection()->NewWindow();
108 content_->SetBounds(root->bounds()); 109 content_->SetBounds(root->bounds());
109 root->AddChild(content_); 110 root->AddChild(content_);
110 content_->SetVisible(true); 111 content_->SetVisible(true);
111 112
112 web_view_.Init(app_, content_); 113 web_view_.Init(shell_, content_);
113 114
114 WindowServerTestBase::OnEmbed(root); 115 WindowServerTestBase::OnEmbed(root);
115 } 116 }
116 117
117 void TearDown() override { 118 void TearDown() override {
118 ASSERT_EQ(1u, window_manager()->GetRoots().size()); 119 ASSERT_EQ(1u, window_manager()->GetRoots().size());
119 mus::ScopedWindowPtr::DeleteWindowOrWindowManager( 120 mus::ScopedWindowPtr::DeleteWindowOrWindowManager(
120 *window_manager()->GetRoots().begin()); 121 *window_manager()->GetRoots().begin());
121 WindowServerTestBase::TearDown(); 122 WindowServerTestBase::TearDown();
122 } 123 }
(...skipping 22 matching lines...) Expand all
145 if (final_update && quit_condition_ == FINAL_FIND_UPATE) 146 if (final_update && quit_condition_ == FINAL_FIND_UPATE)
146 QuitNestedRunLoop(); 147 QuitNestedRunLoop();
147 } 148 }
148 void FindInPageSelectionUpdated(int32_t request_id, 149 void FindInPageSelectionUpdated(int32_t request_id,
149 int32_t active_match_ordinal) override { 150 int32_t active_match_ordinal) override {
150 active_find_match_ = active_match_ordinal; 151 active_find_match_ = active_match_ordinal;
151 if (quit_condition_ == ACTIVE_FIND_UPDATE) 152 if (quit_condition_ == ACTIVE_FIND_UPDATE)
152 QuitNestedRunLoop(); 153 QuitNestedRunLoop();
153 } 154 }
154 155
155 mojo::ApplicationImpl* app_; 156 mojo::Shell* shell_;
156 157
157 mus::Window* content_; 158 mus::Window* content_;
158 159
159 web_view::WebView web_view_; 160 web_view::WebView web_view_;
160 161
161 scoped_ptr<base::RunLoop> run_loop_; 162 scoped_ptr<base::RunLoop> run_loop_;
162 163
163 std::string navigation_url_; 164 std::string navigation_url_;
164 std::string last_title_; 165 std::string last_title_;
165 mojom::ButtonState last_back_button_state_; 166 mojom::ButtonState last_back_button_state_;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 EXPECT_EQ(i, active_find_match()); 309 EXPECT_EQ(i, active_find_match());
309 } 310 }
310 311
311 // We should wrap around. 312 // We should wrap around.
312 web_view()->Find("Green", true); 313 web_view()->Find("Green", true);
313 StartNestedRunLoopUntil(ACTIVE_FIND_UPDATE); 314 StartNestedRunLoopUntil(ACTIVE_FIND_UPDATE);
314 EXPECT_EQ(1, active_find_match()); 315 EXPECT_EQ(1, active_find_match());
315 } 316 }
316 317
317 } // namespace web_view 318 } // namespace web_view
OLDNEW
« no previous file with comments | « components/web_view/web_view_application_delegate.cc ('k') | components/web_view/web_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698