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

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

Issue 1351013002: Revert of Mandoline UI Process: Update namespaces and file names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 10 matching lines...) Expand all
21 21
22 namespace { 22 namespace {
23 const char kTestOneFile[] = "test_one.html"; 23 const char kTestOneFile[] = "test_one.html";
24 const char kTestOneTitle[] = "Test Title One"; 24 const char kTestOneTitle[] = "Test Title One";
25 const char kTestTwoFile[] = "test_two.html"; 25 const char kTestTwoFile[] = "test_two.html";
26 const char kTestTwoTitle[] = "Test Title Two"; 26 const char kTestTwoTitle[] = "Test Title Two";
27 const char kTestThreeFile[] = "test_three.html"; 27 const char kTestThreeFile[] = "test_three.html";
28 const char kTestThreeTitle[] = "Test Title Three"; 28 const char kTestThreeTitle[] = "Test Title Three";
29 } 29 }
30 30
31 class WebViewTest : public mus::ViewManagerTestBase, 31 class WebViewTest : public mojo::ViewManagerTestBase,
32 public mojom::WebViewClient { 32 public mojom::WebViewClient {
33 public: 33 public:
34 WebViewTest() : web_view_(this) {} 34 WebViewTest() : web_view_(this) {}
35 ~WebViewTest() override {} 35 ~WebViewTest() override {}
36 36
37 mojom::WebView* web_view() { return web_view_.web_view(); } 37 mojom::WebView* web_view() { return web_view_.web_view(); }
38 38
39 const std::string& last_title() { return last_title_; } 39 const std::string& last_title() { return last_title_; }
40 mojom::ButtonState last_back_button_state() { 40 mojom::ButtonState last_back_button_state() {
41 return last_back_button_state_; 41 return last_back_button_state_;
(...skipping 26 matching lines...) Expand all
68 } 68 }
69 } 69 }
70 70
71 // Overridden from ApplicationDelegate: 71 // Overridden from ApplicationDelegate:
72 void Initialize(mojo::ApplicationImpl* app) override { 72 void Initialize(mojo::ApplicationImpl* app) override {
73 ViewManagerTestBase::Initialize(app); 73 ViewManagerTestBase::Initialize(app);
74 app_ = app; 74 app_ = app;
75 } 75 }
76 76
77 // Overridden from ViewTreeDelegate: 77 // Overridden from ViewTreeDelegate:
78 void OnEmbed(mus::View* root) override { 78 void OnEmbed(mojo::View* root) override {
79 content_ = root->connection()->CreateView(); 79 content_ = root->connection()->CreateView();
80 root->AddChild(content_); 80 root->AddChild(content_);
81 content_->SetVisible(true); 81 content_->SetVisible(true);
82 82
83 web_view_.Init(app_, content_); 83 web_view_.Init(app_, content_);
84 84
85 ViewManagerTestBase::OnEmbed(root); 85 ViewManagerTestBase::OnEmbed(root);
86 } 86 }
87 87
88 void TearDown() override { 88 void TearDown() override {
89 mus::ScopedViewPtr::DeleteViewOrViewManager(window_manager()->GetRoot()); 89 mojo::ScopedViewPtr::DeleteViewOrViewManager(window_manager()->GetRoot());
90 ViewManagerTestBase::TearDown(); 90 ViewManagerTestBase::TearDown();
91 } 91 }
92 92
93 // Overridden from web_view::mojom::WebViewClient: 93 // Overridden from web_view::mojom::WebViewClient:
94 void TopLevelNavigate(mojo::URLRequestPtr request) override {} 94 void TopLevelNavigate(mojo::URLRequestPtr request) override {}
95 void LoadingStateChanged(bool is_loading) override { 95 void LoadingStateChanged(bool is_loading) override {
96 if (is_loading == false) 96 if (is_loading == false)
97 QuitNestedRunLoop(); 97 QuitNestedRunLoop();
98 } 98 }
99 void ProgressChanged(double progress) override {} 99 void ProgressChanged(double progress) override {}
100 void BackForwardChanged(mojom::ButtonState back_button, 100 void BackForwardChanged(mojom::ButtonState back_button,
101 mojom::ButtonState forward_button) override { 101 mojom::ButtonState forward_button) override {
102 last_back_button_state_ = back_button; 102 last_back_button_state_ = back_button;
103 last_forward_button_state_ = forward_button; 103 last_forward_button_state_ = forward_button;
104 } 104 }
105 void TitleChanged(const mojo::String& title) override { 105 void TitleChanged(const mojo::String& title) override {
106 last_title_ = title.get(); 106 last_title_ = title.get();
107 } 107 }
108 108
109 mojo::ApplicationImpl* app_; 109 mojo::ApplicationImpl* app_;
110 110
111 mus::View* content_; 111 mojo::View* content_;
112 112
113 web_view::WebView web_view_; 113 web_view::WebView web_view_;
114 114
115 scoped_ptr<base::RunLoop> run_loop_; 115 scoped_ptr<base::RunLoop> run_loop_;
116 116
117 std::string last_title_; 117 std::string last_title_;
118 mojom::ButtonState last_back_button_state_; 118 mojom::ButtonState last_back_button_state_;
119 mojom::ButtonState last_forward_button_state_; 119 mojom::ButtonState last_forward_button_state_;
120 120
121 DISALLOW_COPY_AND_ASSIGN(WebViewTest); 121 DISALLOW_COPY_AND_ASSIGN(WebViewTest);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // Now navigate to a third file. This should clear the forward stack. 181 // Now navigate to a third file. This should clear the forward stack.
182 ASSERT_NO_FATAL_FAILURE(NavigateTo(kTestThreeFile)); 182 ASSERT_NO_FATAL_FAILURE(NavigateTo(kTestThreeFile));
183 183
184 EXPECT_EQ(kTestThreeTitle, last_title()); 184 EXPECT_EQ(kTestThreeTitle, last_title());
185 EXPECT_EQ(mojom::ButtonState::BUTTON_STATE_ENABLED, last_back_button_state()); 185 EXPECT_EQ(mojom::ButtonState::BUTTON_STATE_ENABLED, last_back_button_state());
186 EXPECT_EQ(mojom::ButtonState::BUTTON_STATE_DISABLED, 186 EXPECT_EQ(mojom::ButtonState::BUTTON_STATE_DISABLED,
187 last_forward_button_state()); 187 last_forward_button_state());
188 } 188 }
189 189
190 } // namespace web_view 190 } // namespace web_view
OLDNEW
« no previous file with comments | « components/web_view/test_runner/test_runner_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